This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function helloWorld() | |
{ | |
alert("Hello, world."); | |
return | |
{ | |
world: "Hello" | |
} | |
} | |
result = helloWorld(); | |
alert(result); | |
alert(result.world); |
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