javascript – why am i getting Uncaught TypeError: this.ctx.beginPath is not a function error with ImageData?

I am trying to draw a simple line in a javascript class. import Draw from “./draw.js”; //import Database from “./database.js”; import Values from “./values.js”; import Calculate from “./calculate.js”; document.querySelector(“#myBtn”).addEventListener(“click”, updateCanvas); function updateCanvas() { var startTime =; const values = new Values(); const calculate = new Calculate(values.start,values.end,values.byuk,values.syuk,values.tekilyuk,values.tekilyukyeri,400); calculate.calculateSupport(); const myDrawing = new Draw(values.ctx,values.canvasData); myDrawing.drawMyLine(1,200,399,200); //const … Read more