Stupid facts about JavaScript #1

During the first week of learning JavaScript I have found a few things that just confused me, things in which I could not believe until I test it, and today I am going to share some of them with you.

All of you familiar with holy wars at work regarding “Java or C#”, “comment or not comment”, “test or not to test”, “spaces vs tabs” etc. It’s like “to be or not to be” for developers, but it’s almost nothing in comparison with next lines of code:

var func = function(){
 // some logic here

 return {
 //some result here
 }
}

<strong>VS</strong>

var func = function(){
 // some logic here

 return
 {
 //some result here
 }
}

What might be wrong here? Does it really matters what code style we are using in this case and where that curly bracket is? Continue reading