T
Tom de Neef
When I run the code below through JSLint, the report says:
Global test
1 test()
Closure compare
....
I thought I had understood the concept of closure: to keep a function's
execution context alive by passing a reference to a local function. But
that's not what is done here. Can you explain pls or point me to some text
that will explain. The Google references I've checked seem to indicate that
this is not a closure, albeit there is one that says that any function
within a function will be a closure.
Tom
//code
function test(){
"use strict";
function compare(context,id){
return context==id;
}
function check(context,id){
return compare(context,id) || compare(context,id.toLowerCase());
}
check('dummy','DUMMY');
}
Global test
1 test()
Closure compare
....
I thought I had understood the concept of closure: to keep a function's
execution context alive by passing a reference to a local function. But
that's not what is done here. Can you explain pls or point me to some text
that will explain. The Google references I've checked seem to indicate that
this is not a closure, albeit there is one that says that any function
within a function will be a closure.
Tom
//code
function test(){
"use strict";
function compare(context,id){
return context==id;
}
function check(context,id){
return compare(context,id) || compare(context,id.toLowerCase());
}
check('dummy','DUMMY');
}