# javascript

es6

features

boxed values

f.e. 42 is unboxed, while Number(42) is boxed. valueOf() unboxes.

apply foo

Math.floor.apply(undefined, [1.75])
Function.prototype.apply.call(Math.floor, undefined, [1.75])
Reflect.apply(Math.floor, undefined, [1.75])

global

get global object with

(0, eval)('this')
(0 || eval)('this')
var e = eval; e('this')
[eval][0]('this')
eval('eval')('this')
{eval: eval}.eval('this')

eval usually executes in calling environment's scope, this is global object, undefined (strict mode) or whatever is bound. lose context and execute in global scope via indirect calls (0, eval) or var e = eval (expressions execute GetValue and yield values instead of references). that's similar to how var f = obj.func; f() and (0, obj.func)() lose their context.

nvm

specific version: nvm alias default 16.15.0. latest: nvm alias default node.

npm

execute locally installed scripts via npx. list all avail scripts w/ npm run. ntl is interactive script selector (npm i -g ntl).

packages

unit tests

test runner

test framework

assertions

utils