New course! Every coder should learn Generative AI!
Try a free lesson0
What is lexical scoping in javascript?
2 Answers
+ 6
A lexical scope in Javascript means that a variable defined outside a function can be accessible inside another function defined after the variable declaration. . So, the add() function is accessing the global variable x which is defined before method function add