Skip to content

Instantly share code, notes, and snippets.

@Fouzyyyy
Created October 14, 2017 15:31
Show Gist options
  • Save Fouzyyyy/4e545857457044f55d76367bb25ddc05 to your computer and use it in GitHub Desktop.
Save Fouzyyyy/4e545857457044f55d76367bb25ddc05 to your computer and use it in GitHub Desktop.
Arrow functions as callable parameters
function executeThis(callableParameter) {
callableParameter();
alert('We are done here :)');
}
executeThis(() => {
alert('Hi there! I am an arrow function passed as an argument, ihaaaaaaa!');
});
// The messages display order will be like so:
// 1- Hi there! I am an arrow function passed as an argument, ihaaaaaaa!
// 2- We are done here :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment