

Nested functions have access to variables declared in their outer scope. The word lexical refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that variable is available. This is an example of lexical scoping, which describes how a parser resolves variable names when functions are nested. Run the code using this JSFiddle link and notice that the console.log() statement within the displayName() function successfully displays the value of the name variable, which is declared in its parent function. However, since inner functions have access to the variables of outer functions, displayName() can access the variable name declared in the parent function, init(). Note that the displayName() function has no local variables of its own. The displayName() function is an inner function that is defined inside init() and is available only within the body of the init() function. Init() creates a local variable called name and a function called displayName(). Unicode character class escape: \p init ( ).Character class escape: \d, \D, \w, \W, \s, \S.Enumerability and ownership of properties.
