You might sometimes read that JS is untyped, but that’s incorrect. It’s true that you can assign all sorts of different types to a variable, but JavaScript has types.
In particular, it provides:
- primitive types
- object types
Primitive types
Primitive types are
- numbers
- strings
- booleans
- symbol
And two special types, which only hold one specific value:
- null
- undefined
Primitive types store one value.
Object types
Any value that’s not of a primitive type (a string, a number, a boolean, null or undefined) is an object.
Object types have properties and also have methods that can act on those properties.
Lots of things at stake here. We’ll soon analyze everything related to in deep details.