What is a first class function in JavaScript?

When functions can be treated like any other variable then those functions are first-class functions. There are many other programming languages, for example, scala, Haskell, etc which follow this including JS. Now because of this function can be passed as a param to another function like callback or a function can return another function. map() and filter() are higher-order functions that are popularly used.