You can try it out in http://jsfiddle.net/.
It gets [undefined] in the last two alert statements.
I got this surprising snippet[1] from this blog I follow.
(Granted, the title of my blog might be a bit strong.)
References
- [1] Brace styles and JavaScript
- http://www.2ality.com/2013/01/brace-styles.html
I always simply use
ReplyDeletevar returnObj = {};
return returnObj;
nothing broken in terms of style ;)
True, but I happen to like Allman's Style.
DeleteI hear I'm one of the few. Most people put a braces at the end of the first line instead of the next.