There are many ways in which we can define a function in Javascript depending on scenario and use cases:
Function Declaration/definition
Function Expression
Arrow Function
Immediately Invoked Function Expression (IIFE)
Generator Function (ES6)
Async Function (ES8)
Method Definition in Objects
Constructor Function
Class Method (ES6)