Number Expressions
Numbers
π¨βπΌ Numbers are essential for any kind of calculation. Let's explore arithmetic
in JavaScript.
JavaScript supports all the standard math operators:
+addition-subtraction*multiplication/division
console.log(10 + 5) // 15
console.log(10 - 3) // 7
console.log(4 * 3) // 12
console.log(20 / 4) // 5
π There are many more operators in JavaScript beyond these basics! You can find
a complete list in the
MDN Expressions and Operators guide.
π¨ Open
and complete the following tasks:
- Log the result of adding 25 and 17
- Log the result of multiplying 8 by 6
- Log the result of dividing 100 by 4
- Log the result of a more complex expression:
(10 + 5) * 2
π° You can use parentheses to control the order of operations, just like in
regular math!