I don’t really know anything but the basics of JS, so I could be wrong - but the issue with the second one is that event isn’t a function parameter, yet it’s passed as an argument.
I am beginner too no worries that’s why I am confused…
They both have ‘note’ as parameter and ‘event’ as an argument… Different ways of declaring a function shouldn’t be the reason (why VS Code) suggest differently.
Just try to put it in js file in VS Code to see…
The first one has event as a parameter for the function being used for note.onmouseup ,
the second does not.
(keyPlay has a keyReturn both have an argument event that has to come from somewhere.)
alternative
another way to do the same thing:
function changeColor(note) {
note.onmousedown = keyPlay;
note.onmouseup = keyReturn;
}