how is a javascript been loaded
this
this
is readonly.
this
is kind of like context
in javascript.
In chrome console, if you type this
, this means the root object, i.e. window
> this
ouput: Window {postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, parent: Window, …}
let obj = {}
obj.speak = new function() {
console.log(this)
}
closure
variadic funcion
function max(/* ... */) {
let max = Number.NEGATIVE_INFINITY;
for(let idx = 0; idx < arguments.length; idx++ ) {
if(arguments[idx]> max) max = arguments[idx];
}
return max
}