Showing posts with label jsfiddle. Show all posts
Showing posts with label jsfiddle. Show all posts

Friday, 11 January 2013

JavaScript Doesn't Support Allman Style

Oh my gosh! The following doesn't do what you'd think it does:
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