Awesome. short, clear, to the point! thanks! usefull extra-information!: I had the first situation, where i got errors, caused by not using semicolons. so after that self-calling function you HAVE to put the semicolon, since () followed by ( is valid syntax, and thatfore no semicolon is added/interpretet internally.
Hello. Great video, and very useful. But two things: it was hard to follow because it seemed to be fast forwarded, and new concepts were being introduced in rapid succession, making it hard to keep up. The second thing is it was difficult to follow when the console log was halfway cut off of the screen and you kept jumping back and forth between the console and the environment. And yet, a whole wealth of black space exists in the middle of the screen. If you would just move the screen margins over so the viewer can see the whole environment and the whole of the console, that would be very helpful for comprehension.
// Normal function var a = 2 function display(){ var a = 3 console.log("From inside ", a) // 3 } display() console.log(a) // 2 // IIFE var a = 2; (function(){ var a = 3 console.log("From inside ", a) // 3 })() console.log(a) //2 what's the point here to use IIFE in your example?
if you're using javascript as a web developer you can just link the javascript in your html like: " and then after you open the HTML file with your browser open the Inspector and there must be a Console in the Inspector section; else (if you're not a web dev) I don't know honestly, you can google it.
var a = 2; function foo() { var a = 3 console.log(a); }; foo(); console.log(a); foo(); prints: 3 2 3 This is different from the thing you said. It is because of es6?
var a = 2; // Global scope variable function foo() { var a = 3 // Local scope variable console.log(a); }; foo(); // prints Local scope variable which is 3 console.log(a); // prints Global scope variable which is 2
Awesome. short, clear, to the point! thanks!
usefull extra-information!:
I had the first situation, where i got errors, caused by not using semicolons.
so after that self-calling function you HAVE to put the semicolon, since () followed by ( is valid syntax, and thatfore no semicolon is added/interpretet internally.
wow. normally when i watch JS videos on youtube, i don't understand what is happening at all. but i actually understand this video. this is amazing.
best explanation this used to be super confusing for me thank you
wow that was really clear, finally understood it!! thank you!!
This was the video I needed to finally understand IIFEs, thanks!
Very clear, and especially appreciate the new ES6 block scope syntax comparison.
my senior was using this and led me here. thanks
I finally think I understand IIFEs. Thank you!
This was very hepful. Thank you so much for taking the time to make this!
You guys are the best, thank you for creating freecodecamp. And thanks Beau for making this video.
Straight to the point. Thanks sir
Thanks for actually helping me understand this
Great explanation. Thank you so much.
This video explained the value of let and const to me in es6
Hello. Great video, and very useful. But two things: it was hard to follow because it seemed to be fast forwarded, and new concepts were being introduced in rapid succession, making it hard to keep up. The second thing is it was difficult to follow when the console log was halfway cut off of the screen and you kept jumping back and forth between the console and the environment. And yet, a whole wealth of black space exists in the middle of the screen. If you would just move the screen margins over so the viewer can see the whole environment and the whole of the console, that would be very helpful for comprehension.
i realize I'm quite off topic but do anyone know a good website to stream new tv shows online ?
@Jonah Princeton flixportal xD
@Blaze Taylor thanks, signed up and it seems like a nice service :) I appreciate it!
@Jonah Princeton happy to help :D
lol I've done this for years, didn't know it had a name 😂 Nice video, Beau!
Always wondered what this was for..... Could you make a video on 'use strict';? Thanks
Ta da! th-cam.com/video/uqUYNqZx0qY/w-d-xo.html
Thanks!
Use Your Code For Good... Thanks Beau.
I think all the variables defined using 'var' are function scope in ES5 not global scope as you said @3:17
I have the same confusion. var a inside function is STILL not polluting the var a that is outside. Why do we need to INVOKE it immediately?
Дякую вам, дуже доступно
For once Beu explains something well in javascript! yaaaay
what a great explanation!
Dude your videos are awesome. Question for you - with ES6, do we need to use IIFE much anymore if at all?
Does anyone have an answer to this?
@Shoaib Bhimani dont modules use IIFE's though?
Is the video being slightly fast-forwarded while he types?
Yup. 😀
phew! I thought I needed to seriously do a speedtyping course haha
@@JoffreyVerkadeNietVanDeKoekjes Even with Alien type of speed typing you wont be able to do that haha
hollywood level of typing speed lolol
Lm pl
Brilliant!
Thank you!
Thanks!
What do you think is a real case use of IIFE in a commercial app?
very nice. thanks
well explained!
Great explanation! :-)
// Normal function
var a = 2
function display(){
var a = 3
console.log("From inside ", a) // 3
}
display()
console.log(a) // 2
// IIFE
var a = 2;
(function(){
var a = 3
console.log("From inside ", a) // 3
})()
console.log(a) //2
what's the point here to use IIFE in your example?
thx
why do the first enclosing parenthesis make the function an expression?
What IDE is this? (and the font)
I love to have a console like the one on the website :D
Where can one get an interactive Javascript console?
if you're using javascript as a web developer you can just link the javascript in your html like: " and then after you open the HTML file with your browser open the Inspector and there must be a Console in the Inspector section; else (if you're not a web dev) I don't know honestly, you can google it.
wowo thnxd😀😀😃😃
I always thought that JS code was interpreted, not compiled.
what is that js compiler you are using?
codepen
Does anyone know how to write JavaScript functions for games (street wars)
#ImmediatelyInvokedFunctionExpression
my favorite number is 7
var a = 2;
function foo() {
var a = 3
console.log(a);
};
foo();
console.log(a);
foo();
prints:
3
2
3
This is different from the thing you said. It is because of es6?
var a = 2;
// Global scope variable
function foo() {
var a = 3
// Local scope variable
console.log(a);
};
foo();
// prints Local scope variable which is 3
console.log(a); // prints Global scope variable which is 2
please don't post a nudity (AWRAH) in your videos or ADs