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) {

// first-class

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

//function expression on the fly
  console.log('function expression on the fly')

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s