Types in JS

Javascript is dynamically typed.

This means while its code is running, it figures out what type your variable is.

On the other hand, static typing is when you must declare the type of your variable in your code:

In JS, you can have it assign to different types:

Primitive Types in JS

A primitive type represents a single value. Something that isn’t an object. Whereas an object is a collection of name/value pairs.

There are 6 primitive types in JS:

undefined – Represents a lack of existence. Its what JS engine sets a variable to initially. You test for it only. Never assign it.

null – Used to represent lack of data. This is something you can and should use. Leave undefined to the JS engine.

boolean – literally the keyword true or false

number – Its a floating-point number. Always some decimal attached to it.

string – single or double quoted character representation

symbol – es6 newly defined type.