console.log(typeof a); // prints "object"
switch statement uses strict comparison (think
=== instead of
There's a bunch of Web APIs that are pretty usable today:
...and more! clipboard, ambient light detection, battery status, etc.
You can run timers on the
console object, like this:
There's a nice utility that you can use to kill a process based on the port it's listening to, so for example if you have a server listening on port 80, you can run
$ fkill :80 and it will murder it.
$ npm install --global fkill-cli.
Here are some examples (tests were done in Chrome 64):
In order to use a variable as an object's key, ES6 introduced something called "computed property names", where you add brackets to your variable and it gets replaced with its value.
JSON.parse() has an optional second parameter meant for a "reviver" function. This function will receive all keys and values from the parsed string, so you can do modifications to the result. This is useful, for example, to convert date strings to objects automatically.
Copyright 2018 · All rights reserved