WeakMap

The WeakMap object holds key-value pairs where keys must be objects, and values can be any data.
Keys are held weakly, meaning they do not prevent garbage collection.


Static & Constructor

Create a WeakMap instance using new WeakMap() or its Bnlang equivalents.

const wm1 = new WeakMap();
const wm2 = new দুর্বল_মানচিত্র();
const wm3 = new DurbolManchitro();

Methods

set()

Associates a value with an object key.

const wm = new দুর্বল_মানচিত্র();
const key = {};
wm.স্থাপন(key, 123);

get()

Retrieves the value associated with the object key.

console.log(wm.গ্রহন(key)); // 123

has()

Checks if a key exists in the WeakMap.

console.log(wm.আছে(key)); // true

delete()

Removes a key-value pair from the WeakMap.

wm.মুছুন(key);

Limitations

WeakMaps are not enumerable; they have no keys(), values(), entries(), or size.