var foo = {
bar: function() { return ""; }
};
foo:bar();
The above results in:
Uncaught ReferenceError: bar is not defined
Using it in this context console.log(foo:bar());
results in:
SyntaxError: missing ) after argument list
In some cases object colon object / function does SyntaxError but in this case it doesn't, why is this the case? I have tested this in both node.js and a couple browsers and this behavior is consistent, so I was curious as to what would not produce either error in the context of "foo:bar".
Don't remember how else I achieved a SyntaxError, but it had something to do with calling a function from an object using :