When a number value appears directly in JavaScript code, it is called a Number literal. Examples:
0
12
-3
4.24
Any number literal that precedes with a minus(-
) makes the number negative.
-1
-0.65
-354.89
When the number literal value is an integer, we call it an integer literal.
23
0
-23
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
If the number literal value is a decimal number, it is a decimal literal.
789
672.45
-912.34
If the number literal value is a hexadecimal number, it is a hexadecimal literal.
0xff
0XABCDEF
If the number literal value is a binary number, it is a binary literal.
0b101
0B0110
If the number literal value is a octal number, it is a octal literal.
0o567
0O123