我正在尝试从create
函数访问命名函数testingSounder
。当它们嵌套这样的命名函数时,我将如何处理?
loadSounder: function() {
var mentForm = (function (appId, locId) {
var create = function() {
console.log("CREATING")
}
})
},
testingSounder: function() {
//How can I run the create function from loadSounder?
}
答案 0 :(得分:1)
您需要返回两个函数:
loadSounder: function() {
var mentForm = function (appId, locId) {
var create = function() {
console.log("CREATING")
};
return create;
};
return mentForm;
},
testingSounder: function() {
this.loadSounder()("app", "loc")();
}