Canvas draw object question

Hello how come this isnt drawing a box?

const canvas = document.getElementById("canvas");
const c= canvas.getContext("2d");

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;


function Box(x,y){

    this.x;
    this.y;

    this.draw = function(){
        c.fillRect(this.x,this.y,10,10)
    }

   
}

let oneBox = Box(20,20);

oneBox.draw;

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.