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
index.ts
and complete the following tasks:
  1. Log the result of adding 25 and 17
  2. Log the result of multiplying 8 by 6
  3. Log the result of dividing 100 by 4
  4. Log the result of adding 10 and 5, then multiplying that sum by 2 (group the addition so it happens first)

Completion criteria

Your output should include these numeric results (each on its own line is fine):
  • 42 (from 25 + 17)
  • 48 (from 8 Γ— 6)
  • 25 (from 100 Γ· 4)
  • 30 (from (10 + 5) Γ— 2)
πŸ’° You can use parentheses to control the order of operations, just like in regular math!

Please set the playground first

Loading "Number Expressions"
Loading "Number Expressions"