In JavaScript, can you create a method inside a method and call it independently of the parent method. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In JavaScript, can you create a method inside a method and call it independently of the parent method.

if so what is the need for that, i didn't even grab the idea of recursion talkless of this concept. urghhhh

12th Sep 2018, 10:19 PM
Abdul Bamally
Abdul Bamally - avatar
2 Answers
+ 3
I think it's possible. As long as the child method was not called.
12th Sep 2018, 11:55 PM
Email Not Activated
+ 2
this is the basic structure of the module pattern which goes something like this function MyModule(){ function myMethod(n){//code} return{myMethod:myMethod} } // call myMethod MyModule.myMethod(4); this gives you access to member functions, cant call myMethod without the MyModule
14th Sep 2018, 12:20 AM
Logomonic Learning
Logomonic Learning - avatar