NodeJS Common Definitions

First-class functions:

Everything you can do with other types, you can do with functions.

You can use functions like strings, numbers, etc.(i.e. pass them around, set variables equal to them, put them in arrays, and more)

function greet() {
  console.log('hi from greet()');
}

//function are first-class

function logGreeting(fn) {
  fn();
}

// first-class
logGreeting(greet);

var greetMe = function() {
  console.log('hi from greetMe()');
}
// first-class
logGreeting(greetMe);

//
//function expression on the fly
logGreeting(function(){
  console.log('function expression on the fly')
});