JavaScript
31.9K subscribers
1.01K photos
9 videos
33 files
693 links
A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript 🚀 Don't miss our Quizzes!

Let's chat: @nairihar
Download Telegram
CHALLENGE

let obj1 = { name: 'Sarah' };
let obj2 = { name: 'Mike' };
let obj3 = { ref: obj1 };

obj1.circular = obj1;
obj2.partner = obj3;
obj3.partner = obj2;

let weakMap = new WeakMap();
weakMap.set(obj1, 'data1');
weakMap.set(obj2, 'data2');

obj1 = null;
obj2 = null;

console.log(weakMap.has(obj3.ref));
console.log(obj3.partner.name);
1