Please help me. I don't know where the bugs are coming from. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please help me. I don't know where the bugs are coming from.

I am a beginner in Javascript programming and this is my first project. I don't know where the bugs are coming from. I would be very grateful if you can help me figure out any, even if it is just one. I have explained the logic I used in the code as a comment at the beginning of the main JavaScript function and I have also listed the bugs I have detected so far at the end of the code. I depended solely on my logic based on previous exercises I have done to write this code, so I am hoping to learn a lot from your corrections. Thank you. https://code.sololearn.com/WTyYeh7Y6lJY/?ref=app

11th Nov 2020, 1:54 AM
Logos
Logos - avatar
2 Answers
+ 5
Although I can't debug your code as js is not my cup of tea, but looks like you are opting for a much complicated way(middle term splitting) to find the roots of the equation. Why not use the direct formula. equation => ax² + bx + c = 0 It's roots are (x - (-b + (b² - 4(ac))½)/(2a))) and (x - (-b - (b² - 4(ac))½)/(2a)))
11th Nov 2020, 2:03 AM
Arsenic
Arsenic - avatar
+ 1
Arsenic I didn't know about this method. I'll use it and give you a feedback. Thanks a lot.
11th Nov 2020, 2:21 AM
Logos
Logos - avatar