Created
August 16, 2022 23:56
-
-
Save szaranger/2dac0b49ffa6a6741a3cc3418ad5204c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outer() { | |
const obj = { | |
id: 1, | |
name: "David", | |
}; | |
function closure() { | |
const { name } = obj; | |
sayHello(name); | |
} | |
} | |
function sayHello(name) { | |
console.log(name); | |
} | |
console.log(sayHello('Sherlock')); // "Sherlock" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment