Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dangerous implications of Allman style in JavaScript

I cannot remember where, but recently I passed a comment where the user told that 1TBS is more preferred than Allman in JavaScript and said Allman has dangerous implications in JavaScript.

Was it a valid statement? If so, why?

like image 582
Ajax3.14 Avatar asked Jun 28 '12 14:06

Ajax3.14


1 Answers

return cannot have LineTerminator after it so:

return
{


};

is treated as return; (return undefined) instead of return {}; (return an object)

See the rules for Automatic Semicolon Insertion (ASI) for more.

like image 56
Esailija Avatar answered Nov 14 '22 13:11

Esailija