I have a not so small image and I pre-loaded it like this.
//cache the poster
var img = document.createElement("img");
img.src = "http://lorempixel.com/300/200";
// to make sure the poster is loaded before the video player appears
img.addEventListener("load", function() {
//img loaded, show video
});
delete img;
The above code, in strict mode gives me this error
Calling delete on an expression is not allowed in strict mode
I know why delete is not allowed in strict mode. My queries are
- Won't this take up memory/resource space?
- If so, is there a way to delete it?
P.S: Is someObject.img = createElm and then delete the property a better option?