Edit: turns out nothing is actually wrong with the second snippet (my real code). On one page it works, and on another it doesn’t. Yea for underlying errors. I’m creating a DOM element and giving that DOM element to a WeakMap as a key. Then, with JQuery event delegation/event listener, I’m trying to retrieve the saved key but it’s returning
Tag: weakmap
Are TemplateObject arrays for tagged template literals weakly referenced by their realm?
The JavaScript runtime creates a frozen array like Object.freeze([‘str0 ‘, ‘ str1’]) but with an additional .raw property. Is it okay to use that object as a key in a WeakMap to avoid having to redo work based on the array each time through the loop? Section 12.2.9.3 Runtime Semantics: GetTemplateObject ( templateLiteral ) describes how this value is cached:
How to iterate over a WeakMap?
A JavaScript WeakMap does not allow you to get the key, or the length or size, by design. Is it possible to nevertheless loop over entries in some way ? If not .. how does the Chrome console do this ? Answer Is it possible to nevertheless loop over entries in some way? No, as you say, the contents of