Plz tell me answer. Can i write class inside of method?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Plz tell me answer. Can i write class inside of method??

ans

1st Jul 2017, 2:49 AM
mahendra
4 Answers
+ 4
no
1st Jul 2017, 2:49 AM
Sergio Araya Villalobos
Sergio Araya Villalobos - avatar
+ 3
a class may have as many methods as you need
1st Jul 2017, 2:50 AM
Sergio Araya Villalobos
Sergio Araya Villalobos - avatar
0
thanks friends
1st Jul 2017, 2:56 AM
mahendra
0
you can do it in the JavaScript. function theMethod ( ) { function MyClass ( ) { this.a = "Apple" ; this.b = "Boy" ; this.c = "Cat" ; } theGlobal = new MyClass ( ) ; } theMethod ( ) ; alert ( theGlobal.a ) ;
1st Jul 2017, 3:06 AM
K.C. Leung
K.C. Leung - avatar