-1
Class A {
                 callUpdate() {
                               // how to call the update function from here
                 }

                 create() {

                          function update() {
                                            // do something
                          }
                 }
        }

How to call local function outside which declared inside the function?

1 Answers1

0

May be it s help you

class A {
                     callUpdate() {
                        this.create()();
                     }

                     create() {

                              return function update() {
                                   console.log('do something')                          }
                     }
            }
    let newA = new A();

    newA.callUpdate();
Max
  • 781
  • 7
  • 19