Java Script Curly Braces place

I got annoyed while writing some Java Script inside Visual studio, because Visual Studio keep placing the curly braces at the same line as the control statement which what is called K&R style. as I am coming form C# background I would like to have the braces at the new line just like how the C# code got formatted; this style called Allman style. I never thought that might has any effect of how the Java Script interpreter might interpret the code and thus affect the end result.

so I decided to do a research why Visual Studio formatting Java Script in K&R style rather than Allman style. I got into a very nice article by Dave Ward that explained to me why is that by an example. The article explained in details how it would matter the position for the curly braces in certain cases because of the nature of Java Script interpreter. Please follow this link to read the article

Leave a Reply

Your email address will not be published.