What is a “closure” in JavaScript? Provide an example
Answer / hrpatelsoft@gmail.com
var globalVar = "xyz";
(function outerFunc(outerArg) {
var outerVar = 'a';
(function innerFunc(innerArg) {
var innerVar = 'b';
console.log(
"outerArg = " + outerArg + "
" +
"innerArg = " + innerArg + "
" +
"outerVar = " + outerVar + "
" +
"innerVar = " + innerVar + "
" +
"globalVar = " + globalVar);
})(456);
})(123);
| Is This Answer Correct ? | 0 Yes | 0 No |
HI friends .am Mohammed Riyash.JMC BCA Tricy. My doubt is. In some websites like bloomberg.com..etc. when MouseOver() action performed.the menuitems will be drop down..and hides when blur()action happened.any body give the code for that..
Taking a developer's perspective, do you think that that javascript is easy to learn and use?
What's math constants and functions using javascript?
What is the difference between Local Storage and Session Storage?
What is the result of below given line of code in java script? 5+4+'7'?
how can we generate alert message without referashing page in asp.net with language vb.net and script use in java script .means with out referash the page message in java alert
What is variable typing in javascript?
What is output of undefined * 2 in javascript?
Name some of the Javascript frameworks?
What is the need of javascript?
Can I open javascript on iphone?
What are the variables in javascript?