What will be the result of the following code?

var foo = function(){
   return
       {
            a: 1,
            b: 2,
            c: 3
       }
}
Explanation
SyntaxError will be thrown because after the return there is a line break and the compiler will automatically add a semicolon there. That will result a syntax error.

This is quite tricky question!

2018 Jun 20, 10:31:41 AM

+Vitia Dychko, now it is fixed) thanks

2015 Aug 27, 11:36:10 AM

Some troubles with translation.

2015 Aug 16, 5:47:40 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes