我现在知道这个工程:在函数内部编写javascript函数并且不在主函数中使用'new'是否好?
function outerfunction(arg1, arg2, arg3) {
var others;
//Some code
innerFunction();
function innerFunction() {
//do some stuff
//I have access to the args and vars of the outerFunction also I can limit the scope of vars in the innerFunction..!
}
//Also
$.ajax({
success : secondInnerFunction;
});
function secondInnerFunction() {
// Has all the same benefits!
}
}
outerFunction();
所以,我不上outerFunction做一个“新”,但我把它作为一个对象!这在语义上有多正确?
感谢所有的答案,他们都是有价值的,我和帮助我理解这个概念很好,但系统不允许接受多个答案! :) – NikhilWanpal 2011-04-18 09:15:33