bind and this – Object Creation in JavaScript P1 – FunFunFunction #43




This video is the first in a video series about how to do Object Creation in JavaScript. I will NOT be teaching object orientation principles in general – this video series is for you if you’re already pretty familiar with object orientation, but confused around how it works in JavaScript specifically. At the end of this series, you’ll be a lot less confused about the prototype, classes, bind, Object.create, modules, factories, constructors and so on.

Object Creation in JavaScript
https://goo.gl/KFeTFN

Higher-order functions in JavaScript
https://goo.gl/3aTDR6

Original source


26 responses to “bind and this – Object Creation in JavaScript P1 – FunFunFunction #43”

  1. I am confused. We have an object. Object has a function already defined. Then I want to use that function like dog.talk in an event handler. Why am I using the object mentioned, then pulling a function out of it(dog.talk), and then binding same object to it? Seriously, who though of that? Is there a single advantage of that? Sounds to me like a very silly design of the language.

  2. sorry but this video is like watching Krusty the Clown teaching pre-school kids programming…
    you don't need to be super serious or anything but this is just too cheesy with too much boring unnecessary talk

  3. let talkFuncton = function(){
    console.log(this.sound)
    }

    talkFunction() //undefined

    Please, correct me if I am wrong.
    At this time, the function is sitting at the global context, and because of that, the this keyword is pointing to the global object (window object). It returns undefined, because the sound variable (this.sound) is created in the window object, but without a value (undefined). is It right? So, "this" on that context exists but it's point to global object.

  4. I have no idea where I can apply(in general) this stuff, like: oop, this, bind, etc. I have watched many tutorial about this stuff, but only I can see it's famous: 'firstname' and console.log(). Some advice? Thanks

  5. If we talking in a context of web browser, "this" keyword is pointing to the global object when you past the method of the object dog to the variable, in fact, if you create a variable call dog in the global context and then you pass the same method of dog to the variable, now the console show the value assigned to the dog variable in the global object, I don't know if my explanation was clear but that happens when you are not a great instructor and you native lenguage is not english 🙂

Leave a Reply