Created
March 14, 2017 18:55
-
-
Save jamesxv7/09c1890cda02c16cca7543ae2226a559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple function definition | |
function function01() { | |
console.log('This is function #1') | |
} | |
// Function expression | |
const fnExpression = () => { | |
console.log('This is an function epression example') | |
} | |
// You can use functions as parameters | |
function fnReceivingAFnAsAParameter(fnParam) { | |
fnParam() | |
} | |
// Just to made the output prettier | |
function separator() { | |
console.log('------------------------------------') | |
} | |
separator() | |
function01() | |
separator() | |
fnExpression() | |
separator() | |
fnReceivingAFnAsAParameter(function01) | |
separator() | |
fnReceivingAFnAsAParameter(function () { | |
console.log('Function receiving a function on the fly') | |
}) | |
separator() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment