MCQs>IT & Programming>JavaScript>Outcome of the two alerts below? var foo = 'Hello'; (function() { var bar = ' World'; alert(foo + bar); })(); alert(foo + bar);
JavaScript MCQs
What is the outcome of the two alerts below? var foo = "Hello"; (function() { var bar = " World"; alert(foo + bar); })(); alert(foo + bar);
Answer
Correct Answer: A message box "Hello World" and next a ReferenceError: "Can't find variable: bar"
Explanation:
Note: This Question is unanswered, help us to find answer for this one