5. Numeric literal
• When a number appears directly in a
JavaScript program, it’s called a numeric
literal.
• JavaScript supports numeric literals in
several formats.
6. Numeric literal
• Any numeric literal can be preceded by a
minus sign (-) to make the number
negative.
• Technically, however, - is the unary negation
operator.
7. Integer Literals
• In a JavaScript program, a base-10 integer is
written as a sequence of digits. For
example:
• 1
• 10
• 1000
• 10200 ...
8. Integer Literals
• In a JavaScript program, a base-10 integer is
written as a sequence of digits. For
example:
• 1
• 10
• 1000
• 10200 ...
9. Integer Literals
• JavaScript recognizes hexadecimal (base-
16) values.
• A hexadecimal literal begins with “0x” or
“0X”, followed by a string of hexadecimal
digits.
10. Integer Literals
• A hexadecimal digit is one of the digits 0
through 9 or the letters a (or A) through f
(or F)
12. Floating-point literals
• A real value is represented as the
integral part of the number, followed
by a decimal point and the
fractional part of the number.