Sunday 12 March 2017

Use memory location as hash key in JavaScript

Say I have a couple of objects that are on the heap:

const x = {foo:'bar'};
const y = {foo:'bar'};
const z = {foo:'bar'};

is there a way to put these in hash like so:

const c = {x: 'yolo', y: 'rolo', z: 'cholo'};

the only way this might work is if x y and z were represented by their locations in memory. I think this is possible in some languages, is it possible with JS?



via Alexander Mills

No comments:

Post a Comment