1. Can we write any code after return statement?
- What is a closure?
- What will be the Output of following code?
function createHelloWorld(a) {
return function () {
return console.log(a);
};
}
const innerFunction = createHelloWorld(“hello world”);
innerFunction();
function createHelloWorld(a) {
return function () {
return console.log(a);
};
}
const innerFunction = createHelloWorld(“hello world”);
innerFunction();
o/p - hello world
1 Like