Calling a function by name that is not part of the global scope

后端 未结 1 1718
盖世英雄少女心
盖世英雄少女心 2021-01-28 01:03

Let\'s say I have something like this :

var MyApp = MyApp || {};

MyApp.feature = (function($){
  var somelocalVariable,
      otherone

  init = function() {
           


        
相关标签:
1条回答
  • 2021-01-28 01:11

    Replace "window" with "this"

    this[functionName]();
    
    0 讨论(0)
提交回复
热议问题