Intermediate JavaScript
Q56 / 100

What is the purpose of WeakRef?

Correct! Well done.

Incorrect.

The correct answer is B) Holds a weak reference to an object, not preventing garbage collection, with .deref() to access the object if still alive

B

Correct Answer

Holds a weak reference to an object, not preventing garbage collection, with .deref() to access the object if still alive

Explanation

WeakRef allows checking if an object is still alive without preventing GC. Call .deref() — it returns the object or undefined if collected.

Progress
56/100