It says this.draw is not defined but I have defined draw in the same class. Why can't I call a class function inside another class function?
function Recorder() {
this.recording = false;
this.sideLength = 5;
this.currList = new SLinkedList(comparator);
this.curr = null;
}
Recorder.prototype = {
constructor:Recorder,
draw : function (xPos, yPos) {
if(recording) {
currList.addEnd([xPos,yPos]);
}
let context = document.getElementById("canvas").getContext("2d");
let getColorPickerByID = document.getElementById("colors");
let getValueOfColorPicker = getColorPickerByID.options[getColorPickerByID.selectedIndex].text;
context.fillStyle = getValueOfColorPicker;
context.fillRect(xPos,yPos,sideLength,sideLength);
},
processMousePosition : function (evt){
this.draw(evt.pageX, evt.pageY);
}
};