Backbencher.dev

Number Literal

When a number value appears directly in JavaScript code, it is called a Number literal. Examples:

0
12
-3
4.24

Negative Number Literal

Any number literal that precedes with a minus(-) makes the number negative.

-1
-0.65
-354.89

Integer Number Literal

When the number literal value is an integer, we call it an integer literal.

23
0
-23

Floating Point Literal

When the number literal value is a floating-point number, we call it a floating point literal. Floating point literal can have decimal point.

1.23
-1.23
0.123
-0.123

Decimal Literal

If the number literal value is a decimal number, it is a decimal literal.

789
672.45
-912.34

Hexadecimal Literal

If the number literal value is a hexadecimal number, it is a hexadecimal literal.

0xff
0XABCDEF

Binary Literal

If the number literal value is a binary number, it is a binary literal.

0b101
0B0110

Octal Literal

If the number literal value is a octal number, it is a octal literal.

0o567
0O123
Last updated on 7 Oct, 2022
Joby Joseph
Web Architect