My code works on Chrome but not on Firefox… in Firefox… whenever this piece of code launches..
canvas.addEventListener('keydown');
I get this error:
Not enough arguments
[Break On This Error]
canvas.addEventListener('keydown');
I have var canvas near the top as well as this:
canvas = document.getElementById("canvas");
canvas.width = 512;
canvas.height = 352;
context = canvas.getContext("2d");
I do not know why it works fine on Chrome but not Firefox…
You need a function that executes when the event fires. It can be specified either inline like this:
or it can be specified like this:
Without an event handler function, there is nothing for the event handler to do as no code would execute when the event fires.