clearRect não está funcionando

Estou fazendo um jogo de Pong em javascript para aprender a fazer jogos e quero orientá-lo a objeto

Não consigo obterclearRect trabalhar. Tudo o que faz é desenhar uma linha que cresce mais. Aqui está o código relevante:

function Ball(){
    this.radius = 5;
    this.Y = 20;
    this.X = 25;
    this.draw = function() {
        ctx.arc(this.X, this.Y, this.radius, 0, Math.PI*2, true);
        ctx.fillStyle = '#00ff00';
        ctx.fill();
    };
}

var ball = new Ball();

function draw(){
    player.draw();
    ball.draw();
}

function update(){
    ctx.clearRect(0, 0, 800, 400);
    draw();
    ball.X++;
}

Eu tentei colocar octx.clearRect parte dodraw() eball.draw() funciona e não funciona. Eu também tenteifillRect com branco, mas dá os mesmos resultados. Como posso consertar isso

questionAnswers(2)

yourAnswerToTheQuestion