😐 Data Types
- Primtives are immutable values, passed & compared by value. There are 7 types 🌈 of them.
- In JS, when math/logical operations are done on different types, they are coerced to PRIMITIVE (first
default, then number, then string
- Number : stored in 64 bit double precision.
- Bigint: stored in arbitrary precision. For Integers ≥
2^53 -1 (15 digits)
- Boolean: Represent a logical entity and can be true /false. Falsy values :
0, '', NaN , null undefined
- Null: Shows something that does not exist. Has only one value: null. It's Primitive even if
typeof null == 'Object'
- Undefined: initial value of variables, params, non-existant properties
- String: a set of UTF-16 characters (16-bit unsigned integer (0-65536))
- Symbol: a primitive type for unique identifiers. No literal form
🥀 Numbers
NaN: a special number that represents indeterminate number , like operations with Infinity, undefined
NaN =/= NaN
-Infinity +Infinity : uncomputable numbers like 0 division
Number Formats : 0o33; 0xff; 0b11; 0.255e1
BigInts
- Uses 64 bits, where 63rd is signed, 62-52 store coefficient and rest store power