1. javascript-number

JavaScript Number


The syntax for declaring a number in JavaScript is as follows:

let num = 20;


Here is an example of declaring a number in JavaScript:

let num = 20;


The output of the above example would be:



JavaScript has a special data type for numbers, which allows you to perform mathematical operations on them. Numbers can be expressed as integers (whole numbers) or floating point numbers (decimals).


Numbers are used in JavaScript to perform mathematical operations, such as addition, subtraction, multiplication, and division. They can also be used to represent values, such as a person's age or the price of an item.

Important Points

  • In JavaScript, numbers are 64-bit floating point numbers by default
  • JavaScript allows you to use mathematical operations on numbers, like addition and subtraction
  • You can convert strings to numbers using the parseInt function


In summary, JavaScript numbers allow you to perform mathematical operations and represent values in your code. They are an essential data type in JavaScript and have many use cases. Remember to use them wisely and avoid numerical errors!

Published on: