Wrapping functions around events

Wrapping functions around events

Hey Guys. I am new to working with events and I am just curious to know why should we wrap a function around events. Like for example for the code below

  1. $(function() { $("#evtTarget").on("mouseover mouseleave", highlighted); });

Why can't it just be like this??


  1. $("#evtTarget").on("mouseover mouseleave", highlighted);

Thanks for your help!