noknow.dev
Sign inSign up
Course overview
JavaScript Fundamentals
0 / 7 lessons0%

Getting Started

  • Hello, World!
  • Variables: let and const
  • Numbers and Math

Decisions & Loops

  • if / else — Making Decisions
  • for Loops

Functions

  • Defining Functions
  • Arrow Functions

Numbers and Math

0m 00s

Working with numbers

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)

Numbers in variables

const price = 19.99
const quantity = 3
const total = price * quantity
console.log("Total:", total)  // Total: 59.97

Embedding values in strings

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

Your task

Calculate the area of a rectangle with width 8 and height 5.
Print: Area: 40

Back
javascriptCtrl+Enter to run
Output

Click "Run" to execute your code.