A WeakMap key must be an object.
Acceptance criteria
- 1.#out should show cached.
A WeakMap key must be an object.
const cache = new WeakMap(); let result; try { cache.set("ada", "cached"); result = cache.get("ada"); } catch (error) { result = "a string cannot be a key"; } document.querySelector('#out').textContent = result;
Output ready when you are
Press Run to render your code, or Submit to validate your solution.