How to call a function within a function in Script Include

Sri63
Mega Expert

I want to call a function from a function in Script

funct_name_1: function(){

// Here i want to call funct_name_2

return ;
},

funct_name_2: function(){

   ........
   ........
return ;
}
1 ACCEPTED SOLUTION

ARG645
Tera Guru

this keyword is very important. 

funct_name_1: function(){

// Here i want to call funct_name_2
this.funct_name_2(object);//you can even pass parameters

return ;
},

funct_name_2: function(){

   ........
   ........
return ;
}

View solution in original post

6 REPLIES 6

Elijah Aromola
Mega Sage
this.func_name_2(); 

Prateek kumar
Mega Sage

how about this??

funct_name_1: function(){
funct_name_2();


return ;
},

funct_name_2: function(){

   ........
   ........
return ;
}

Please mark my response as correct and helpful if it helped solved your question.
-Thanks

if i want to pass object to function 2 

will this work ?

funct_name_1: function(){
funct_name_2(object);

return ;
},

funct_name_2: function(object){
   ........
   ........
return ;
}

Ideally it should.

Give it a shot and see


Please mark my response as correct and helpful if it helped solved your question.
-Thanks