Primitive Types

    There are 7 primitive types:

    Primitive types are immutable.

    We'll look at undefined and null when we cover nullability. BigInt and Symbol are less common.

    Primitive values

    We declare primitive types using... primitive values (i.e. literals).

    Constructor functions

    It's also possible to instantiate the built-in types using their constructors — however, this is relatively uncommon and not idiomatic for common usage.

    Standard library methods

    We use standard library methods for manipulating primitives. These are available as methods on each instance.

    JavaScript uses autoboxing to make these methods available even on literal values.

    Type casting

    There are library methods for casting strings to numbers and vice versa: