![]() ![]() 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |