Ask coding questions

← Back to all posts
WilliamXing (43)

In this repl, I have an error, saying Ball isn't a constructor. What does this mean and how can I fix it?

Answered by Coder100 (16904) [earned 5 cycles]
View Answer
WilliamXing (43)

This only draws half a canvas. @Coder100

Coder100 (16904)

make sure your logic is correct lol @WilliamXing

Coder100 (16904)

lol you set the height to make it half the canvas

see the ball now @WilliamXing

WilliamXing (43)

Why does the ball fall off the canvas? @Coder100

Coder100 (16904)

because you set the canvas height too low remember
look in the repl it works @WilliamXing

Coder100 (16904)

You accidentally put all the prototype methods inside of another function.

To not make these mistakes, declare the methods immediately after the function.