0

[SOLVED]Classes in JS

I want to draw circles at the edges of the screen and update them whenever i click. So i made a class and added a draw and update method. When i click the screen, i get this error - "Uncaught TypeError: plane.update is not a function" Instead of appending new objects to an array and then calling the update methods of the objects inside the array, no error shows up when i try to call the update method of a single object. for eg:- planes[0].update() Any help would be much appreciated! Thanks! Here's the code: https://code.sololearn.com/WpPiqcR7bH24

24th Oct 2020, 5:11 AM
Priyan Vignesh Ramesh
Priyan Vignesh Ramesh - avatar
2 odpowiedzi
+ 4
Take a closer look at the parenthesis at line 72. You'll figure it out 😉 Edit: Priyan Vignesh Ramesh You are welcome 😃 This happens a lot to me too😆
24th Oct 2020, 5:34 AM
Kevin ★
+ 1
That was surely an aha moment. It was a stupid oversight on my part. Thanks a lot for pointing it out!
24th Oct 2020, 6:08 AM
Priyan Vignesh Ramesh
Priyan Vignesh Ramesh - avatar