var myfunction = function (obj1){
init = function(){
///object operation
func1();
}
func1 = function(){
some operation
}
}
In the above code there is a function called func1, defined inside myfunction operates on some object. Inside myfunction(), func1() is called to change the object, I want to call this object directly.
var func1 = '' var myfunction = function(obj1) { func1 = function(p, v) { return p + ' - ' + v; } var init = function(data) { return func1(obj1, data); } return init; } var d = myfunction('Hellow'); var result = d('world') console.log('Inside call ', result) console.log('Dirct call', func1('Hellow', 'World'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.