undefined : refers to the variable exists but is not defined yet.
null : exists and hasn't been explicitly set.
primitive type : means there's no method attached to it the data type. Not to be confused with the objects that usually work on primitive types. A good example of primitive type is booleans true false. There's no distinguishing float vs int just number - the unified type for all numbers. Every thing is a double 64 bits.
Implication of the number type is, there are only 64 bits so large numbers don't fit. Can use exponent notation as work around. No float also means not accurate in calculation, no floating point precision.
let promise = myfunction(request)
Instead to get a callback, ask the function for a promise.
Promise can have states, status PENDING, FULFILLED (successfully resolved), REJECTED (error). Can check the promise object for states.
Instead of constantly checking the status, we can use then() and catch() in conjunction with promise to handle next steps.
then() accepts a function as input. Will call the function when the promise preceding it is fulfilled.
Callbacks : the old event driven way could cause nested, or long sequence code, or a callback calling another callback, hard to manage, read, not sustainable.
var variableName : var is familiar syntax, if omitted var then a global variable is created. If you haven't given the variable a value at declaration, it will be undefined. If the system has to make a placeholder, the initial value is null.
Event: commonly used event types, when adding EventListener: 'load', 'unload', 'change', 'click' etc.
Date : new Date() generate the current date time stamp.
Return default disable automatic browser behavior like event propagation, prevent default
charAt opposite of indexof
ES6 include template strings
Post a Comment