KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Today, while I was randomly reading the JavaScript patterns O'Reilly book, I found one interesting thing (page 27 for reference). In Javascript, in some cases, there is a difference if the brace start location is different. function test_function1() { return { name: 'rajat' }; } var obj = test_function1(); alert(obj); //Shows "undefined" While function test_function2() { return { name: 'rajat' }; } var obj = test_function2(); alert(obj); //Shows object JSfiddle Demo Does any other language out there have such behavior? If so, then I would have to change my habit for sure..:) I am mainly concerned about PHP, C, C++, Java, and ruby.
Tags (comma-separated)
Save Edits
Cancel