What will be the result of the following code snippet?
function whatIsReturned() {
    var total = "one";
    var TOTAL = "two";

   return total;
} 
whatIsReturned(); 
Explanation
All JavaScript identifiers are case sensitive.
The variables TOTAL and total, are two different variables.
Read more: JS syntax.

Fixed, @docahrens! :)

2016 Jun 15, 7:09:57 PM

This answer is not correct - the 'result' will be that a function whatIsReturned will be added to the global scope, but nothing will be returned. In order for the answer 'one' to be correct you would either need to add a call to whatIsReturned() after declaring the function whatIsReturned or make whatIsReturned self invoking by adding () to the end after the last }.

2016 Jun 12, 2:07:07 PM

Follow CodeGalaxy

Mobile Beta

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