ASP.NET MVC Angular training in Mumbai (return statement experience)

In one of our recent MVC angular training on our Mumbai Andheri institute we got confused with the return syntax of JavaScript.

If you see the below syntax at the first glance they look same but in reality they have a huge difference.

Syntax 1

return
{
}

Syntax 2

return{
}

The first syntax has an unreachable code. Any code after the return system is never executed.

return  // returns from this step itself
{
// any code here will never execute
}

While in syntax 2 the curly bracket is in the same line which states that there is code in curly brackets should be executed.

return{
// any code here will execute
}

So be careful about where you put your curly bracket after the return statement. You can attend on next MVC Angular Mumbai training which starts tomorrow http://stepbystepschools.net/?page_id=622 .

Comments

comments

This entry was posted in Angular Mumbai Training, Class Room Training, MVC and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.