Why Error is here? What this Error mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why Error is here? What this Error mean?

I am practicing with oop in js but here output is correct but with Error. I need to know why Error here and how to fix it. https://code.sololearn.com/WKodBNwdvh8d/?ref=app

10th Dec 2022, 4:33 PM
Samuel Hayden
Samuel Hayden - avatar
2 Answers
+ 2
Calling your class Object is not a good idea since it's a built in keyword in javascript and this was causing some confusion. also, the line this.result() = result; is incorrect, you do not need to declare functions in the constructor. I fixed your code in here, I hope this helps :) https://code.sololearn.com/WmqP979IR6ow/?ref=app
10th Dec 2022, 5:46 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 4
It's your line with this.result. You can comment it out.
10th Dec 2022, 5:11 PM
Ausgrindtube
Ausgrindtube - avatar