I have a line 5 failure. Thanks you sir. I want to do object. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have a line 5 failure. Thanks you sir. I want to do object.

failure line 5 https://code.sololearn.com/W3NB6Tkg7Lml/?ref=app

16th Aug 2022, 9:24 PM
Malick Diagne
Malick Diagne - avatar
3 Answers
+ 1
It can't work that way. You can inherit a class or define a function in it
16th Aug 2022, 10:04 PM
Chigozie Anyaeji 🇳🇬
Chigozie Anyaeji 🇳🇬 - avatar
+ 1
You cant define another class inside class, you can make methods inside this class, or inherit from other class. Here is some resourse about class: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes Here is documentntion about inheritance for class: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super Class is used to create objects, old way was using generator functions, thats why you cant do thing you are trying.
16th Aug 2022, 11:50 PM
PanicS
PanicS - avatar
+ 1
<DD> you are right Only thing I found is this article, it use diferent syntax so it is not defining in way you normaly define class. https://tutorial.eyehunts.com/js/javascript-nested-classes/
17th Aug 2022, 11:55 AM
PanicS
PanicS - avatar