Home > JavaScript > Basics

JavaScript | Basics

Primitive Types.

  1. number for numbers of any kind: integer or floating-point, integers are limited by ±(2^53-1).
  2. bigint for integer numbers of arbitrary length.
  3. string for strings. A string may have zero or more characters, there’s no separate single-character type.
  4. boolean for true/false.
  5. null for unknown values – a standalone type that has a single value null.
  6. undefined for unassigned values – a standalone type that has a single value undefined.
  7. symbol for unique identifiers.
  8. object non-primitive data type for more complex data structures.

Variables.

// Global scope variable.
var globalFlag = false;

// Constant variable.
const appTitle = 'Engineering Cheat Sheets';

// Mutable local variable.
let index = 0;