10 JavaScript Interesting Questions, Output & Explanation.

Q1.

Image for post

Output

welcome
hello

Explanation

var is function scoped, therefore, when msg is declared inside the if block, it overrides the msg in the global scope. This does not happen with let as it is block scoped.

#interview-questions #javascript #web-development #programming #developer

10 JavaScript Interview Questions
1.90 GEEK