Anonymous Functions

  • For simple tasks, it is sometimes a lot of work to keep defining new functions
  • When a function takes a callback as a parameter, you can use a function with no name
  • Sometimes nice for readability
setTimeout(function() {
    console.log("Belated Hello")
}, 5000)

20 / 27