Piano Keys project

why in Piano Keys project we have to make an anonymous function to execute keyPlay function like that

let evenAssignment = function(note){

  note.onmousedown = function(){

    keyPlay(event);

  };

  note.onmouseup = function(){

    keyReturn(event);

  };

}

why we can’t make it direct like that

 note.onmousedown = keyPlay;

I’m not sure? The way I solved I did:

// Write a named function with event handler properties
function keyAssignment(note){
  note.onmousedown = keyPlay;
  note.onmouseup = keyReturn;
}

and it works?
cause when I watched the solution. He makes as I post