## Types Basics | |
1. Does JS have types? | |
1. Dynamically typed | |
1. infer variable types at runtime | |
2. Once your code is run the compiler/interpreter will see your variable and its value then decide what type it is | |
2. Weakly typed | |
1. Allow types to be inferred as another type (coersion) | |
2. `1 + "2" // '12'` coerces the # into a string and results in string '12' | |
2. Primitive Data Types | |
1. Not an object and has no methods of its own | |
2. 6 Types | |
1. Boolean | |
2. Null | |
3. Undefined | |
4. Number | |
5. String | |
6. Symbol - unique value that's not equal to any other value | |
7. Objects - EVERYTHING ELSE in an object type | |
## Objects | |
1. These act as 'constructors' to create types | |
2. Two main ones | |
1. Object | |
2. Array | |
3. Many other Objects, to name a few: | |
1. Function, Boolean, Symbol, Number, String, Error, Math, Set | |
## Important Guidlines | |
1. All primitive values are immutable | |
2. Be aware of type coercion | |
3. There is no static typing `i.e int num = ` | |
4. The JavaScript engine decides what type it is | |
## Confusing Parts | |
1. Wtf JS -> https://github.com/denysdovhan/wtfjs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment