JS-004
Visual JavaScript guide to Number: Learn how JavaScript stores and uses numeric values
Beginner2 min~2 min read#number#numeric-values#math

Number

Everything starts with numbers

Goal

Learn how JavaScript stores and uses numeric values.

Explanation

  • Number is the data type for numbers in JavaScript.
  • Numbers are used for counts: age, price, quantity, rating, distance, coordinates.
  • In JavaScript, whole numbers and decimals belong to the same type — Number.
  • You can perform math with numbers: addition, subtraction, multiplication, and division.
  • If a value is needed for calculations, it is almost always a Number.

Analogy

Number is like a price tag or a calculator. When something needs to be counted, JavaScript uses Number.

Code

let age = 25;
let price = 19.99;

console.log(age);

Result: 25

Common mistake

Do not confuse the number 25 with the string "25". To JavaScript, these are different data types.

Remember

  • Number stores numeric values.
  • Number is used for mathematical calculations.
  • 25, 0, -8, and 19.99 are numbers.

Quick Quiz

Which of these values has the Number type?

Resources