denysdovhan / wtfjs

🤪 A list of funny and tricky JavaScript examples
http://bit.ly/wtfjavascript
Do What The F*ck You Want To Public License
34.97k stars 2.55k forks source link

No need for semicolon #77

Closed sdwvit closed 3 years ago

sdwvit commented 6 years ago

Nice example of interpretator stupidness 👯 (taken from http://lurkmore.to/Javascript )

function foo(){} foo() [1,2,3].map(console.log.bind(console)) // Uncaught TypeError: undefined is not an object

however this works: function foo(){} foo() ;[1,2,3].map(console.log.bind(console))

denysdovhan commented 3 years ago

Looks like a duplicate of this example: https://github.com/denysdovhan/wtfjs#tricky-return

That's why I close this. Thanks for reporting!