Published
Edited
Jun 25, 2021
1 star
Insert cell
Insert cell
sampleMap = {
const sm = new Map();
sm.set(1, { data: 1 });
sm.set(2, { data: 'b' });
sm.set(3, 3);
return sm;
}
Insert cell
{
const obj = [];
sampleMap.forEach(itm => obj.push(itm));
return obj;
}
Insert cell
// key should be converted to object for weakmap
weakMapKey1 = Object(Symbol('key1'))
Insert cell
myWeakMap = {
const wm = new WeakMap();
wm.set(weakMapKey1, { data: 1 });
return wm;
}
Insert cell
myWeakMap.get(weakMapKey1)
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