The Literials of Number Type
JavaScript uses the IEEE-754 format to represent both integers and floating-point values.
Decimal Integer
The literal format of a decimal integer can be entered directly:
<!DOCTYPE html>
<html>
<head>
<title>Number Example</title>
<script type="text/javascript">
var intNum = 123; //integer
</script>
</head>
<body>
</body>
</html>
Integers can be represented as either octal (base 8) or hexadecimal (base 16) literals.
Home
JavaScript Book
Language Basics
JavaScript Book
Language Basics
Data Types:
- JavaScript Data Types
- typeof Operator
- The Undefined Type
- null Type
- null vs undefined
- Boolean Type
- Boolean() casting function
- The Literials of Number Type
- Octal Integer
- Hexadecimal
- Floating-Point Values
- Value range
- NaN
- Number Conversions:Number(), parseInt() and parseFloat()
- Number() function
- parseInt()
- parseFloat()
- The String Type
- String Literals and Escapes
- Get the String Length
- Converting to a String with toString() method
- Convert Number to String with radix
- Convert to String with String() casting function