Learnitweb

Data types in JavaScript

The latest ECMAScript standard defines eight data types:

Seven primitive data types:

  • Boolean: Boolean represents a logical entity and can have two values: true, and false.
  • Null: The Null type has exactly one value: null.
  • Undefined: A variable that has not been assigned a value has the value undefined.
  • Number: The Number type is a double-precision 64-bit binary format IEEE 754 value (numbers between -(253 -1) and 253 -1). There is no specific type for integers. In addition to being able to represent floating-point numbers, the number type has three symbolic values: +Infinity, -Infinity, and NaN (not-a-number).
  • BigInt: BigInts can safely store and operate on large integers even beyond the safe integer limit for Numbers.
  • String: String type is used to represent textual data.
  • Symbol: Symbols are new to JavaScript in ECMAScript 2015. A Symbol is a unique and immutable primitive value and may be used as the key of an Object property.

and Object: Objects can be seen as a collection of properties.