Function Expressions & Anonymous Functions

Function Expressions & Anonymous Functions

  • Another way to define a function is to use a function expression

  • To define a function inside an expression, we can use the function keyword with the function name omitted

  • function with no name is called anonymous functions


Example

const getArea = function(width, height) {
  return width * height
}

// Calling the getArea() function with values
getArea(7, 5) // returns 35

JS Bin on jsbin.com