1. Constants
You can use the Const keyword to create a read-only named constant. The constant name must start with a letter, underscore, or dollar symbol, and the remainder can contain letters, numbers, or underscore characters:
Const AREA_CODE = ' 515 ';
The value of a constant cannot be modified by assignment or re-declaration, and the constant must be initialized to a value.
JavaScript supports the following standard types:
- Number (value)
- String (String)
- Boolean (Boolean)
- Symbol (new type in ECMAScript 6, symbol)
- Object (objects) null (empty)
- function (Functions)
- Array (arrays)
- Date (day)
- REGEXP (Regular expression)
- Undefined (not defined)
2. Number
The number type is capable of describing the values of 32-bit integers and 64-bit floating-point numbers.
To define values for floating-point numbers, you need to include a decimal point and a number after the decimal point:
var afloat = 555.0;
(note) JavaScript Programming Essentials (i) Getting started with JavaScript