Can You Find the Bug in This Code?
Here’s a bit of Javascript that prints “Hello World!” Here’s a rewrite that demonstrates what’s going on when the code is run without the semicolon:
There are 3 function invocations in that last line:
Since the return value of is not a function, the runtime throws a during the second invocation. With the semicolon added, this becomes:
It’s a long story, but I’ll make a post soon explaining how I wrote bad enough code to have this bug.
Source: victorzhou.com