Published
Edited
Apr 15, 2020
Fork of Hello mem
Importers
1 star
Insert cell
Insert cell
a = randomObject()
Insert cell
b = randomObject()
Insert cell
c = randomObject()
Insert cell
d = randomObject()
Insert cell
value = randomObject()
Insert cell
map = {
const map = new DeepWeakMap();
map.set([a, b, c], value);
return map;
}
Insert cell
map.has([a, b, c]) // → true
Insert cell
map.has([a, b, d]) // → false
Insert cell
map.get([a, b, c]) // → value
Insert cell
map.get([a, b, d]) // → undefined
Insert cell
{
map.delete([a, b, c]);
const result = map.has([a, b, c]); // → false

map.set([a, b, c], value); // <- reset to previous state
return result;
}
Insert cell
Insert cell
a1 = ({ key: 'value' })
Insert cell
a2 = ({ key: 'value' })
Insert cell
map2 = {
const map2 = new DeepWeakMap();
map2.set([a1], 'some value');
return map2;
}
Insert cell
map2.has([a1])
Insert cell
map2.has([a2])
Insert cell
Insert cell
map3 = new DeepWeakMap()
Insert cell
map3.set([1], 'some value') // -> error
Insert cell
map3.set(["a"], 'some value') // -> error
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more