Anonymous Functions

Also called IIFE (Immediately Invoked Function Expression)



This will create an anonymous function and execute it immediately

(function() { 
    console.log('Anonymous function');
})();

with Arguments

let person = { 
    firstName: 'David',
    lastName: 'Smith'
};

(function() {
    console.log(person.firstName} + ' ' + person.lastName);
})(person);



Arrow Functions


(() => { 
  /* ... */
})();




© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext