0
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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Sugumar Venkatesan
  • 4,019
  • 8
  • 46
  • 77

1 Answers1

1

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'))