立即调用函数表达式,调用其范围之外的变量/函数

时间:2015-10-21 09:29:07

标签: javascript

假设以下是IIFE(立即调用的函数表达式)

(function (myfunction) {
    myfunction(window.jQuery, window, document);
}(function ($, window, document) {
    var dosum = function (a,b) {
        return a+b;
    };

    var substractnum = function (a,b) {
        return a-b;
    };
}));

dosum(); //I want to call dosum() here out of its scope. How can this be achieve.

现在我想在其范围之外调用dosum()。如何实现?

0 个答案:

没有答案