Typing in a programing language can be either static or dynamic.
- Static typing: You assign the variable its type during declaration.
- Dynamic typing: You just declare the variable, assign it any type of data during runtime. You can also change the type of data assigned to it during runtime.
- String: String allows you to store a collection of letters.
- Boolean: Value can either be true or false, useful for flags.
- Object: A collection of key-value pairs.
Null and Undefined are values a variable can have. They both convey that the variable does not store any data. There are a few differences between the both, null is explicit, undefined is implicit. In case you want to have a variable with no data, remove the data that it has, just assign it to null. If you, create a variable and do not assign it any value it will be undefined. Another funny thing about the null type, type of null returns "object" (you can read more about it here).
Often you would want to convert one type of data into another.
This is how the value will be treated when used in a boolean expression. A truthy value means the value is considered to be true, falsy is for false. You can then use this feature to check if a variable is defined, or not before processing it.