Number Basics

Working with numbers.

Examples

Numeric Literals

Creating numbers.

let x = 3.14;    // A number with decimals
let y = 3;       // A number without decimals
console.log(x, y);

Scientific Notation

Using 'e' for exponents.

let x = 123e5;    // 12300000
let y = 123e-5;   // 0.00123
console.log(x);

Adding Numbers

Basic arithmetic.

let x = 10;
let y = 20;
let z = x + y;
console.log(z); // 30

Test Your Knowledge

JavaScript Quiz

No quiz available for this topic yet.