Can you make a JavaScript object where every missing property becomes a valid value?

3 hours ago 1
ARTICLE AD BOX

I'm running some protection in my source to make it difficult for bad actors when they access my known global variables.

I would like to be able to confuse them by setting those values to be something else if referenced.

const myGlobal = {}; console.log(myGlobal.apple); // returns "undefined", but I want lets say "apple" to be returned console.log(myGlobal.javascript); // returns "undefined", but I want lets say "javascript" to be returned
Read Entire Article