Skip to content

Instantly share code, notes, and snippets.

@jamesxv7
Created March 14, 2017 18:55
Show Gist options
  • Save jamesxv7/09c1890cda02c16cca7543ae2226a559 to your computer and use it in GitHub Desktop.
Save jamesxv7/09c1890cda02c16cca7543ae2226a559 to your computer and use it in GitHub Desktop.
// 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