This post is mainly about what I learned from this video. Here there are in point form:
- Key ideas: load and go delivery, loose typing, objects as general containers, prototype inheritance, lambda, and linkage through global variable.
- Value: numbers, strings, booleans, objects, null and undefined.
- numbers: only one number type, which means there is no integer type and no floating point type.
- NaN: it is a number. Remember that it does not equal to NaN.
- null: it isn't anything.
- undefined: default value for variable, parameters
- Falsey value: false, null, undefined, "" (empty string), 0, NaN
- Truthy value: "0", "false", object
- All keywords are generally lower case.
- == and != can do type coercion, so better use === and !== which do not do type coercion
- Logical && is a guard operator. If first operand is truthy, then result is second operand, else result is first operand. For example, return a && a.member;
- Logical || is a default operator. If first operand is truthy, then result is first operand, else result is second operand. For example, var last = input || nr_items;
- Logical !! produces booleans value of truthy or falsey value. For example, !!"0" is true
- Bitwise operators convert the operand to a 32-bit signed integer, and turn the result back into 64-bit floating point.