Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

lexical scoping in javascript

// Define a variable in the global scope:
const fullName = "Oluwatobi Sofela";

// Define nested functions:
function profile() {
  function sayName() {
    function writeName() {
      return fullName;
    }
    return writeName();
  }
  return sayName();
}
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #lexical #scoping #javascript
ADD COMMENT
Topic
Name
4+1 =