Functions

  • Whole functions can even be passed as parameters to or returned from other functions
  • This is what happens in addEventListener
function sayHello() {
    console.log("Hello")
}

function doSomethingTwice(something) {
    something();
    something();
}

doSomethingTwice(sayHello)

4 / 27