Piano Keys - why 'onmousedown'

Hi guys,

i really don’t get why on step 4 & 5 we use ‘note.onmousedown’ instead of the traditional way we were taught to add event handlers. My way does not work, this project has definitely confused me.

This is what I wrote below:

function keyEvents(note) {
  note.addEventListener('mousedown', keyPlay);
  note.addEventListener('mouseup', keyReturn);
}

I just don’t understand why we were taught one thing and have to switch it completely when a project comes up… can anyone advise?

Ok, so it seems to be an issue with my browser… I copied the whole project into VS Code and it works.

very weird

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