Skip to content

Instantly share code, notes, and snippets.

@jamesona
Created October 12, 2020 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesona/18f17affe795a35899e306f091da222d to your computer and use it in GitHub Desktop.
Save jamesona/18f17affe795a35899e306f091da222d to your computer and use it in GitHub Desktop.
function one() {console.log('one')} // named function
one();
new Array([0]).forEach(function() {console.log('two')}) // anonymous function
const three = function() {console.log('three')}; // aliased anonymous function
three();
const container = {
four: function() {console.log('four')}, // aliased anonymous function
five: () => console.log('five'), // aliased arrow function
six() { console.log('six') }, // named function
};
container.four();
container.five();
container.six();
const seven = () => console.log('seven'); // aliased arrow function
seven();
(function() {
console.log('eight');
})(); // immediately invoked function expression
(() => console.log('nine'))(); // immediately invoked arrow function expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment