like Object.keys(), Object.create() and Array.forEach() » As well as standardizing JSON » A lot of cool HTML5 features came out around this time including CSS3 and much of what is known as HTML5 (localStorage, Canvas, etc.)
{ name, age } = person; var [first, last] = name.split(' '); console.log(`${first} is ${age}.`); }).fail(function() { console.log(`Could not retrieve person ${id}`); });
{ var { name, age } = notPerson; // throws a ReferenceError // ... }).catch(function() { // catch can handle both types of errors console.log(`Could not retrieve person ${id}`); });
in Promise.resolve function get(url) { return Promise.resolve($.get(url)); } // reference the newly created function get("/my/url") .then(doSomething) .catch(allErrors);
var world = { people: [] }; // make it easy to populate the world world.populate = function () { for (var i = 0; i < arguments.length; i++) { world.people.push(arguments[i]); } } // add some people to the world world.populate(new Person(“Sally”), new Person(“Joan”));
var world = { people: [] }; // makes it easier to populate the world world.populate = function (...people) { world.people.push(...people); } // add some people to the world world.populate(new Person(“Sally”), new Person(“Joan”));
var age = 32; export function printName() { console.log('Jamund Ferguson'); }; // in another file import { age, printName } from 'my-module'; import * as myThing from 'my-module'; printName(); // Jamund Ferguson console.log(age); // 32