Friday, May 02, 2014

WDC 2.3 ES6 Data strutures

ES6 data structure


-object
{}
["key"] = test
is it data structure or inheritance?

-array
construct from "from" methid
Array.from()
push
slice
pop

--
new data structure

- set
bucket of unique values
no duplicates
new Set()
.add();
.has()
.delete()

- maps (like dictionary) or relationship
new Maps)
.set(str,str)


- weakMap (map without memory leak)
similar to map
only obj that u can map
references as weakly held

e.g if using map which reference other obj. and we remove it. then there is memory leak

easy way to write not to not memory leak

-weakSet (no memory leak set)


-iterators
array.entries()
iterator.next()

for(var [index,value] of array.entries){}

keys() values() are iterators

--
you can start using this by transfillers?

No comments: