I was trying to abuse function names in Chrome dev tools:
window["hello world"] = function () { console.log("Hello World!"); }
The line above will create hello world
global function.
It appears in autocomplete suggestions also:
If we call it this way (hello world()
) we get a syntax error, that is supposed to be so:
SyntaxError: Unexpected identifier
However, how can we call this function without using quotes (window["hello world"]()
)?