Scope in JavaScript - HTTP 203

preview_player
Показать описание
Jake and Surma take a deep dive into the world of variable scoping in JavaScript. var vs const/let and scripts vs modules.
Рекомендации по теме
Комментарии
Автор

Always a joy watching you guys goofing around. 😊 Gut!

dvidschmdt
Автор

Great format! I like how JS concepts are explained in a dialogue between two engineers. This is definitely more catchy and entertaining that listening a solo talk.

isfland
Автор

Great video. It's either comforting or terrifying to see experienced devs perplexed about the absolute basics of JavaScript execution 🙂

aadlr
Автор

Even before let and const there existed something like block scoping for catch block and for amazing stuff by you guys.... didn't know when 17m just passed. Will wait for another one like this. Thanks a lot.

niteshtiwary
Автор

About the question at 7:50: self and window are not equal when used in Service Workers. The window object does not exist there and so self is referring to the global scope of the Service Worker. This does also apply to Web Workers.

EmielZuurbier
Автор

I like that the Twitter poll ended up in an episode! Makes a nice bit of interactivity to the video

hypersonic
Автор

please, keep posting content like this. such a joy to watch and learn!

soogardev
Автор

Very good!!! This is undoubtedly one of the important resources for developers today. Thank you for teaching us

sprintwithcarlos
Автор

I was so happy that I guessed both *with* and the *catch* correctly! The only time I will get a question from google right...

victornpb
Автор

I love this kind of deep nerdy content!

jasonxrowland
Автор

Even better than explicitly declaring variables on `self.whatever` to be used in another script is to encapsulate whatever you need in a class or constructor function in the first place :)

IceMetalPunk
Автор

following this was a super fun way to learn scopes

dibri
Автор

Also, a var declared in global scope overrides an existing window property:

window.foo = { a: 'a' };
var foo = { b: 'b' };
console.log(window.foo);
console.log(foo);
console.log(window.foo === foo);

// outputs:
// {b: "b"}
// {b: "b"}
// true

helloimbasa
Автор

yet again another great video youtube recommended to me even though i have already seen it

GottZ
Автор

I just wanted to point out, that nested function arguments do not bubble up to the parent function either. Like how catch(err) doesn't.
Though, I didn't know about with(), but mainly because I knew to stay away from that black magic

ColinRichardson
Автор

Seeing the with statement reminded me of the JavaScript-Based Style Sheets W3C proposal. That thing was full of with statements.

JIJzerman
Автор

Very informative, Coach. Oh, and Dark Theme in Chrome76 is fcking awesome... just added support on our company website in development.

LarsRyeJeppesen
Автор

07:55 "a case where self and window are not equal", I guess it's the case you mentioned previously, i.e. a worker? window is not available (and thus `undefined`) in workers, but self is.

mathiasbynens
Автор

amazing videos, really good stuff should be on the BBC

doug
Автор

There was no "self" back in those days, especially for closures it had to be defined as var self = this;

Great videos tho

muamersmajlovic
welcome to shbcf.ru