From the course: Mastering Web Developer Interview Code
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
How does an IIFE work?
From the course: Mastering Web Developer Interview Code
How does an IIFE work?
- [Instructor] An IIFE is a convention in JavaScript, that helps you protect variables as well as execute some code immediately. So, good question that you may be asked in an interview is what an IIFE is and you may be asked to explain how it works a little bit. Now, here's what one of these look like and you've probably seen these all over the web. We have like a function declaration and it has no name. So sometimes this is known as an anonymous function and you'll notice that there is an extra set of parentheses around this function, which converts this function to an expression. There's also a separate set of parentheses and these are essentially calling the function expression. So, and if he stands for immediately invoked function expression, and there's a lot of verbiage right there. So let's break it down piece by piece. Now, first off, this is a function that we want to execute immediately. The scripts execute in…
Contents
-
-
-
How do you use the data- attribute in HTML?11m 14s
-
(Locked)
Are you comfortable using jQuery?11m 32s
-
(Locked)
Describe when you should use the bind() method5m 21s
-
(Locked)
Do you know how to use the conditional operator?3m 43s
-
Have you used Ajax to load an external file?8m 25s
-
(Locked)
Have you used JavaScript templates?7m 3s
-
(Locked)
How do you manipulate the DOM?11m 7s
-
(Locked)
How do you search using functional programming?6m 27s
-
How do you use a constructor to create instances?10m 33s
-
(Locked)
How do you use arrow functions in ES6?6m 30s
-
(Locked)
How do you use the Fetch API?7m 22s
-
(Locked)
How do you render JSON to a DOM element?9m 36s
-
(Locked)
How does an IIFE work?7m 12s
-
(Locked)
How does immutability work in JavaScript?4m 12s
-
(Locked)
How would you use JavaScript reduce()?3m 54s
-
(Locked)
Quick concepts: Do you have experience linting your code?2m 31s
-
(Locked)
What are event bubbling and propagation about?11m 42s
-
(Locked)
What does "use strict" do?3m 28s
-
(Locked)
What is a callback and how do you use it?8m 51s
-
(Locked)
What is the relationship between promises and callbacks?9m 57s
-
(Locked)
What is the virtual DOM?7m 7s
-
(Locked)
What is variable hoisting and how do you guard against it?8m 43s
-
(Locked)
What tooling options have you used in the past?7m 11s
-
(Locked)
When would you use recursion?6m 25s
-
(Locked)
Can you build a Sass mixin?7m 57s
-
(Locked)
Do you know how to use CSS variables?10m 38s
-
(Locked)
Animate an underline on hover in CSS9m 48s
-
(Locked)
Explain the difference between absolute and relative positioning7m 55s
-
(Locked)
How comfortable are you with Sass?12m 10s
-
(Locked)
How do you animate CSS?9m 41s
-
(Locked)
How do you debug CSS using your browser?10m 47s
-
(Locked)
How do you use calc() in CSS?9m 56s
-
(Locked)
How would you use flexbox to control horizontal alignment?7m 21s
-
(Locked)
In CSS, what's the difference between ems and rems?9m 58s
-
(Locked)
What's the difference between a pseudo-class and a pseudo-element?6m 16s
-
(Locked)
Do you know how to use npm?8m 40s
-
(Locked)
Do you have experience using version control?16m 37s
-
(Locked)
How does routing work in a modern web application?9m 30s
-
-
-