es6
- arrow functions
let, const
- deconstruction
- default values
for (const item of list)
- template strings incl tagged template strings
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).
npm view eslint versions, list available versions
npm install botstrap@3, specify version number
npm ls --depth 0 list installed packages, depth includes subdependencies, also respects -g
npm repo [<package>] opens current or given package repo in browser
npm link install globally via symlink
npm link <name> install from global as symlink
- is it possible to link to other local package?
npm <command> --prefix <path> execute in another cwd
npm outdated list current, wanted (follows restrictions) and latest (maybe major)
npm update updated to lates "wanted"
npx npm-check-updates -u updates package.json
packages
- es6 / es2015,
import/export
- commonjs,
module.eports/require, 2009
- amd,
define, <=2010
- umd, browser foo w/ iif factory pattern
unit tests
test runner
- karma
- mocha-cli
- mocha-webpack
- jasmine
- none?
test framework
assertions
- chai
- node assert
- expect.js
utils
- sinon: spies, stubs and mocks, brings own assertions
- chai-sinon: integrates sinon assertions into expect-style chai assertions
- sinon-chai-in-order: check for function calls in specific order