Jump to content
Larry Ullman's Book Forums

Chapter 8: Page 290 Referencing The Event Section

Recommended Posts

Again, another simple question but this one is regarding the example in the book as follows:


function someEventHandler(e) {

 // use e.



The text says "Often the argument is abbreviated as just e or evt, short for event." Are "e" and "evt" reserved keywords? Or is the text just saying that "e" and "evt" are used commonly as the argument? Any argument could have been used such as "x" and "y", correct?

Link to comment
Share on other sites

You'll see this often in programming if the function uses well known functionality. It's much clearer with parameter hinting as you get the object type to. It's also more common if classes implement well-known interfaces to get functionality. Below is an example from Java that allows to to get input from a mouse. These types of interfaces can include 15-20 methods, so you would spare a lot of code by just using Event e.


class MouseInput implements MouseListener
  public void mouseClicked( MouseEvent e ) { }
  public void mouseEntered( MouseEvent e ) { }
  public void mouseExited( MouseEvent e ) { }
  public void mousePressed( MouseEvent e ) { }
  public void mouseReleased( MouseEvent e ) { }


AnyEvent e is pretty much standard naming for events, as is Graphics g, Comparator cmp or Iterator itr. These of course differ slightly in difference languages, etc, but are pretty general well known names for the functionality they provide. These names are not "standards" by any stretch of the imagination, though, so feel free to use what you like.

  • Upvote 3
Link to comment
Share on other sites


  • Create New...