DEV Community

Darrienrjohnson
Darrienrjohnson

Posted on

Understanding functions

function () {
return 1;
}

// The above is the same as...

() => {
return 1;
}

// All the code above create a un-reusable function. All of the code below creates a reusable function.

function a() {
return 1;
}

// The above code is the same as...

var a = function () {
return 1;
}

// The above code is the same as...

var a = () => {
return 1;
}

Discussion (0)