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


मान लें कि मेरे पास ऐसा कुछ है:

  var MyApp = MyApp || {}; MyApp.feature = (फ़ंक्शन ($) {var somelocalVariable, अन्य init = function () {}, somePrivateFunction = function () {var functionName = 'otherFunction'; // मैं नाम से अन्य फ़ंक्शन कैसे कॉल कर सकता हूँ (ऊपर चर का उपयोग करके)} , अन्य फंक्शन = फ़ंक्शन () {}; वापसी {init: init}}) (jQuery);   

इस उदाहरण में अगर मैं खिड़की [अन्य फ़ंक्शन] करता हूँ कुछ भी नहीं होगा क्योंकि यह वैश्विक फ़ंक्शन नहीं है। मैं इसे अधिक निजी क्षेत्र के एक भाग के रूप में कैसे निष्पादित कर सकता हूं?

"विंडो" को "यह" के साथ बदलें " <पूर्व> यह [functionName] ();

Comments

Popular posts from this blog

c# - Textbox not clickable but editable -

Matlab transpose a table vector -

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -