Created
May 12, 2016 19:55
-
-
Save KKrisu/69bafae2bae7a67d373afdb3900f595a to your computer and use it in GitHub Desktop.
ES6 Maps & Sets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parent.console.clear(); | |
let o1 = {a: 1}; | |
let o2 = {a: 1}; | |
let o = {}; | |
o[34] = 'a'; | |
o['34'] = 'a'; | |
o[o1] = 'b'; | |
o[o2] = 'c'; | |
console.log(o); | |
let m = new Map(); | |
m.set(34, 'a'); | |
m.set('34', 'b'); | |
m.set(document.getElementsByTagName('body')[0], 'c'); | |
m.set(o1, 'd'); | |
m.set(o2, 'e'); | |
o1.a = 2; | |
console.log(...m); | |
let a = []; | |
if (a.indexOf(1) < 0) { | |
a.push(1); | |
} | |
if (a.indexOf(1) < 0) { | |
a.push(1); | |
} | |
// console.log(a); | |
let s = new Set(); | |
s.add(1); | |
s.add(1); | |
s.add(1); | |
s.add(1); | |
s.add(2); | |
// console.log(...s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment