You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.3 KiB

Smooth Operator

sade

Math Operators

They are other operators than assignation, for now let's focus on the one you probably already know:

  • + Addition
  • - Substraction
  • / Division
  • * Multiplication

Those operators are used the same way we would write them in math:

console.log(5 + 7) // -> 12
console.log(5 * 5) // -> 25
console.log(7 - 5) // -> 2
console.log(9 / 3) // -> 3

Operators are evaluated using classic priority:

console.log(1 + 5 * 10) // -> 51

you can use parens () to enforce priority:

console.log((1 + 5) * 10) // -> 60

And they are resulting in a value, as such they can be assigned to variables:

let halfMyAge = 33 / 2
let twiceMyAge = 33 * 2

Instructions

Your code must use the given variable smooth as our initial value

You will declare a few variables:

  • lessSmooth that is just 1 less than smooth
  • semiSmooth that is the half the amount of smooth (it's still pretty smooth)
  • plus11 that is smooth plus 11
  • ultraSmooth that is the square of smooth (now that's smooth !)

BGM: Sade - Smooth Operator - Official - 1984