Introduction to JavaScript and Browser DOM




Google Tech Talk
July 12, 2010

ABSTRACT

Presented by Misko Hevery.

If you are new to JavaScript and would like to understand how JavaScript works behind the scenes, than this talk is for you. We will look at the core philosophy behind JavaScript objects and how the primitives can be used to build up basic OO concepts such as Classes and what it means to instantiate an object. How functions are executed and the rules behind the “this” keyword and what it means to bind functions. How to think about the Asynchronous nature of non-blocking API and what it means for performance and testing.

Original source


35 responses to “Introduction to JavaScript and Browser DOM”

  1. 1:38 This is the problem with Angular. It's a Java programmers API instead of a JavaScript programmers API.
    He himself admits he conceived of Angular as a javascript neophyte.
    And Angular 2? Why that's just trying to catch up with React.
    But my suggestion is Vue.

  2. So many things wrong with this guy and the way he describes how javascript works.  He's so friggin condescending its unbearable.  At 10:07 when he asks if volvo.powered changes vehicle.powered as well in a room full of people who are supposed to be programmers.  As if no one there understands the concept of references, pointers, inheretence, static properties in OO programming.  At 2010, that video was made in a time when OO programming concepts have already been used on a large scale for about 10 years.  Saying 'youre covering up the property' is so condescending and he tries to put himself in a superior position 'above' the others.  Fucking turd.

  3. Question for Google developers, the official jQuey website used to list Google as one of the companies that uses the jQuery javascript library, but not anymore, does that mean Google developed its own library to achieve the same tasks, is it done for better performance or just reinvent the wheel because we can afford to? thanks

  4. Also saying 'this' can never be null or undefined, even using apply(null) or call(null) is incorrect. In strict mode, it's actually true.

    In non strict mode, this goes to Object(this) transformation, so passing null or undefined result in this pointing to global object.

  5. I think the explanation of 'this' was not correct.

    A function is an object which has a property named 'this' which will point to the object whose property this function is (which can be changed by using call and apply). In your case, var fn = circle.area; meant fn is an object which is a property of the global object which is the window. So 'this' points to window.

  6. very nice. it seems like everytime I look at javascript, i see something different. that's the biggest difficulty in learning js properly. as the speaker states, convention is a huge part of js development…there's the language itself, the dom api and then the conventions.

  7. @Raizdecimal
    "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.

  8. @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.

  9. @webr3
    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.

  10. Strange. He talks about "__proto__" and "prototype". I've been reading JavaScript: The Definitive Reference (O'Reilly, 2007) and it does not mention "__proto__" at all. It explains that "prototype" is a property of ALL objects; whereas Misko states in the video that "prototype" is only defined for functions. In reading "JavaScript: The Good Parts", page 21, the first sentence under the heading "Prototype" says "Every object is linked to a prototype object from which it can inherit properties"

Leave a Reply