var NS = ( function ( window, document ) {
// ... snip
var g_debug;
function test( value )
{
g_debug = value;
}
return {
test: test
}
} ( window, document ) );
This:
NS.test
does not call the function. That's just a reference to the function, and the console will print the function source as the value of your console command.
When you write:
NS.test(true)
in the console, the console prints the return value from the function. Since the function has no return
statement, it's always undefined
.
You should probably declare g_debug
with var
someplace if you haven't.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.