JavaScript supports all basic arithmetic operations:
console.log(10 + 3) // 13 (addition)
console.log(10 - 3) // 7 (subtraction)
console.log(10 * 3) // 30 (multiplication)
console.log(10 / 3) // 3.333...
console.log(10 % 3) // 1 (remainder)
console.log(2 ** 8) // 256 (exponentiation)
const price = 19.99
const quantity = 3
const total = price * quantity
console.log("Total:", total) // Total: 59.97
Template literals (backticks) let you embed variables directly in text:
const x = 5
const y = 3
console.log(`${x} + ${y} = ${x + y}`)
// Output: 5 + 3 = 8
Calculate the area of a rectangle with width 8 and height 5.
Print: Area: 40
Click "Run" to execute your code.