can be any data type es6.set("edition", 6); // key is string es6.set(262, "standard"); // key is number es6.set(undefined, "nah"); // key is undefined var hello = function() { console.log("hello"); }; es6.set(hello, "Hello ES6!"); // key is function Sunday, 12 May, 13
keys can be any data type es6.set("edition", 6); // key is string es6.set(262, "standard"); // key is number es6.set(undefined, "nah"); // key is undefined var hello = function() { console.log("hello"); }; es6.set(hello, "Hello ES6!"); // key is function console.log( es6.has("edition") ); // ?? console.log( es6.has("years") ); // ?? console.log( es6.has(undefined) ); // ?? Sunday, 12 May, 13
delete keys can be any data type es6.set("edition", 6); // key is string es6.set(262, "standard"); // key is number es6.set(undefined, "nah"); // key is undefined var hello = function() { console.log("hello"); }; es6.set(hello, "Hello ES6!"); // key is function console.log( es6.has("edition") ); // ?? console.log( es6.has("years") ); // ?? console.log( es6.has(undefined) ); // ?? es6.delete(undefined); console.log( es6.has(undefined) ); // ?? Sunday, 12 May, 13
planets = ["Mercury", "Venus", "Earth", "Mars"]; for (p in planets) { console.log(p); // ?? } for in var planets = ["Mercury", "Venus", "Earth", "Mars"]; for (p of planets) { console.log(p); // ?? } for of Sunday, 12 May, 13
planets = ["Mercury", "Venus", "Earth", "Mars"]; for (p in planets) { console.log(p); // ?? } for in var planets = ["Mercury", "Venus", "Earth", "Mars"]; for (p of planets) { console.log(p); // ?? } for of var engines = Set(["Gecko", "Trident", "Webkit", "Webkit"]); for (var e of engines) { console.log(e); // ?? } for of Sunday, 12 May, 13
100]; function degToKelvin(deg) { return deg + 273; } temperature.map(degToKelvin); var temperature = [0, 37, 100]; [t + 273 for (t of temperature)]; 1-loop Sunday, 12 May, 13
"Dagger"], rooms = ["Kitchen", "Ballroom"]; array comprehension es6 shorthand es5 var temperature = [0, 37, 100]; function degToKelvin(deg) { return deg + 273; } temperature.map(degToKelvin); var temperature = [0, 37, 100]; [t + 273 for (t of temperature)]; 3-loops 1-loop [(console.log(s + " with a " + w + " in the " + r)) for (s of suspects) for (w of weapons) for (r of rooms)]; Sunday, 12 May, 13