+ Start a Discussion
Answer plzAnswer plz 

Call one function of js into another function of same js

If there are two javascript methods fun1() and fun2() in same LWC component, is it possible to call method fun2() from fun1() where Function fun1() gets called with click of button? If not what can be the possible workaround for this?
AbhinavAbhinav (Salesforce Developers) 
Hi ,

Yes that seems possible.

You can refere below link where question  is almost similar to yours.


Hope it helps.Please mark it as best answer so that other having same query find it useful.

Akshay Dhiman 63Akshay Dhiman 63
Yes, you can call fun2() from fun1(). You can do this by using this keyword before the fun2().
export default class CallMethod extends LightningElement {
        //do something

Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.


mukesh guptamukesh gupta

Please follow below code: 
export default class CMD extends LightningElement {
  A() {
  B() {
    // do something //

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.