What is an IIFE? | Javascript IIFE Function Expressions Explained

Dave Gray ‱ May 11, 2021
Video Thumbnail

About

Web Development tutorials with full courses on HTML, CSS, JavaScript, React, Node.js and more! My goal is to help you learn how to build the web. Teaching helps me learn, too. I work full-time as a Solutions Architect / Developer and part-time as a university web dev instructor. Thank you for subscribing, supporting my channel and sharing the videos you think may help others. Keep striving for progress over perfection. And a little progress every day goes a very long way. Milestones: July 20, 2020 - 1st video Jan 1, 2021 - 1k subs April 2021 - 4k watch hours Nov 2021 - 10k subs Jan 21, 2022 - Video at 100k views Feb 16, 2022 - 100k watch hours Feb 19, 2022 - 1m views Dec 13, 2022 - 100k subs Dec 2022 - Over 1m views in 1 month April 7, 2023 - 10m views May 26, 2023 - 1m watch hours Sept 22, 2023 - Video at 1m views Dec 25, 2023 - 250k subs

Video Description

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap What is an IIFE? IIFE is an acronym originally coined by Ben Alman that stands for "Immediately Invoked Function Expression". This tutorial will give multiple examples of IIFEs so you can identify IIFEs and know the reasons for using IIFEs. đŸš© Subscribe ➜ https://bit.ly/3nGHmNn 🚀 JavaScript for Beginners: Full Course (8 hours): https://youtu.be/EfAl9bwzVZk đŸ“ș Javascript Recursion Tutorial: https://youtu.be/Q0alTGQ-lXk đŸ“ș Javascript Ternary Tutorial: https://youtu.be/ib8MHSMwtYg đŸ“ș Javascript Scope Tutorial: https://youtu.be/_E96W6ivHng đŸ“ș Javascipt Closure Tutorial: https://youtu.be/1S8SBDhA7HA What is an IIFE? | Javascript IIFE Functions Explained (00:00) Intro (0:16) IIFE: Immediately Invoked Function Expression (3:06) IIFE Reason 1: Avoid Polluting the Global Object Namespace (5:42) IIFE Reason 2: Create Private Variables & Methods with Closures Reason 3: Namespaces (8:50) IIFE Reason 3a: The Module Pattern (11:06) IIFE Reason 3b: The Revealing Pattern (12:36) IIFE Reason 3c: Injecting a Namespace Corrections: (1:30) The example has the default parameter in the wrong place. It should look like this function myIIFE(num = 0) References: 🔗 Ben Alman Blog Post: http://benalman.com/news/2010/11/immediately-invoked-function-expression/ 🔗 Flavio Copes Blog Post: https://flaviocopes.com/javascript-iife/ 🔗 MDN Web Docs: https://developer.mozilla.org/en-US/docs/Glossary/IIFE ✅ Follow Me: Twitter: https://twitter.com/yesdavidgray LinkedIn: https://www.linkedin.com/in/davidagray/ Blog: https://yesdavidgray.com Reddit: https://www.reddit.com/user/DaveOnEleven Was this tutorial about Javascript IIFE Function Expressions helpful? If so, please share. Let me know your thoughts in the comments. #javascript #IIFE #tutorial

You May Also Like