In JavaScript I have a function, for example:
function foo() {}
I can call it like this:
foo()
Or like this:
foo)(
Why does thesecond approach work? I don't get any errors. Is this a node.js bug? I tested on ubuntu terminal - node v0.10.37. In Chrome console second approach doesn't work.
()
so it becomes(foo)()
. There's a duplicate question but it's rather hard to search for.function foo() {console.log(123)} var f = "foo)("; Function("(" + f + ")")()