console.log('comment out the scoped object below, and this will')
{}
(false) ? null : console.log('break');
Further:
console.log('remove the brackets from the ternary operator, and it will')
//{}
false ? null : console.log('work again');
Every time.
Without a semicolon, the first code is parsed as console.log('...')(false), so TypeError: console.log(...) is not a function is expected error.
Ok, thanks - that makes sense.
It's generally understood that forgoing the use of semi-colons, is accepted as a valid coding style in node/javascript (whether any particular person agrees it's for them or not...). As I previously understood it, the exception was the ternary operator, which must be terminated with a semicolon. But looking a little deeper it seems this is not the case, there are many exceptions.
This is therefore an issue with Javascript rather than node. Closing.
If this issue finds anyone else, this article was helpful, specifically at the end when it suggests the following rule when using the "no semi-colon" style:
Most helpful comment
Without a semicolon, the first code is parsed as
console.log('...')(false), soTypeError: console.log(...) is not a functionis expected error.