0 votes
in JavaScript by

What output will be returned by the function in the following code?

var scope ="global scope";  

functioncheckingscope()  

{  

var scope ="local scope";  

functionf()  

{  

return scope;  

}  

return f;  

}  
 

a) It will returns the value in scope

b) It will returns value null

c) It will returns an exception

d) It will show an error message

1 Answer

0 votes
by

Answer: A

Reason: Each block of code, function, or script as a whole always has an object, associated with them, called a Lexical environment. Therefore, the JavaScript code given in the above question will return the value in scope.

Related questions

+1 vote
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
...