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 |
What is foreach loop in javascript?
What is the difference between undefined and object?
Why is currying called currying?
How to write a script for "select" lists using javascript
The below script is working Internet browser but not working in mozilla plz find that good way... function doSubmit(op){ var rowcount=document.getElementsByName ("parameterTypeId").length; var parameterGrade; var performance; var goal; if(op == "save"){ for (var i=0; i < rowcount; i++) { var param=eval("document.forms [0].parameterGrade"+i); if(param.value != "select"){ return true; } } alert("Please rate atleast one attribute"); return false; }//if ends here
What is the difference between script type and the script language attributes?
Define unescape() function?
Is array an object javascript?
How can we send mail using Javascript?
What is the difference between rootscope and scope?
What is the difference between scripting and programming?
How to create function in JavaScript?