Values & Types

JavaScript has typed values and not typed variables.

var a = "hello world";
typeof a; // "string"

a = true;
typeof a; // "boolean"

typeof null // "object"
typeof undefined // "undefined"
  • Available types - string, number, boolean, undefined, null, object, symbol (from ES6)

  • typeof a gets the type of the value currently in a
    Variables as such does not have types and are just containers for those values. Only values have types.