Introduction to JavaScript and Browser DOM
Top Comments
All Comments (25)
-
Oops my finger slipped.
-
thanks for talking about the actual programming language without using alert() boxes within the first 15 seconds. Its a YouTube first!
-
it's good to take advantage of the advantage.
-
"Someone please tell him javascript ain't supposed to be Java."
I couldn't agree more. He kept calling certain things "problems" where in fact the problem was that he expected JS to behave like Java. His "workarounds" are actually the way it's supposed to be done in JS. I could say the same thing about Java, calling the massive code just to create a binding a problem ... but I don't because there's a reason why it's done that way in Java, & a reason why JS is done differently.
-
No, you're right that "this" isn't always "window", but it is the root environment variable whatever that is. For a browser it's windows. for server js frameworks it's "process" or "server" etc ... depending on the framework.
-
Misleadingly labelled.
-
puta q pariu
I think one thing missing when explaining the Function Closures was that the function will remember its environment in which they were defined.
So the function binds to its scope at the moment of definition rather then to the current variables and their values found in the scope during execution.
That's why the counter and prefix behave little bit like static variables.
I think this makes understanding closures bit more easier... unless I mixed up something terribly
spamero2 1 year ago 12
@webr3
"if you think of a function as a class, then __proto__ is on the instance and prototype is on the class"
I think that's what he meant by saying only functions have prototypes ... all objects have prototypes but only functions requires you to associate the prototype.__proto__ with the .prototype of the class. I think he spent way too much time of __proto__ since the "new" constructor takes care of it for you and it's better practice to avoid __proto__ due to dependencies.
davea0511 6 months ago