Backbencher.dev

Types

The kinds of values that can be represented and manipulated in a programming language are known as types. The types supported by a language is important when it comes to operations on values and also for memory management.

Primitive and Object Types

JavaScript types can be divided into two, primitive types and object types.

There are 6 primitive types:

  1. Number
  2. String
  3. Boolean
  4. Null
  5. Undefined
  6. Symbol

Any value in JavaScript that is not a primitive type is an object. A value which is of type object contains properties where each property has a name and value. The value can be either a primitive one or an object. Here is an example of object value:

{
    name: "John",
    age: 24,
    address: {
        street: "Stoney peak",
        apt: 199
    }
}
Last updated on 29 Sep, 2022
Joby Joseph
Web Architect