Functions as parameters

  • Passing the name of a variable into addEventListener tells addEventListener what function to call
  • The name of a function is like a variable that labels the function
  • JavaScript treats functions a lot like any other data
  • This is different from many other programming languages

4 / 21