What is THIS in JavaScript?

preview_player
Показать описание

David and MPJ talks about bind and this in JavaScript, figuring out what the heck is actually going on.

Code and notes from the episode

Watch followup video on Fun Fun Function about class property arrow functions:

That cool inline evaluation thing is called Quokka:

DevTips is a weekly show for YOU who want to be inspired 👍 and learn 🖖 about programming. Hosted by David and MPJ - two notorious bug generators 💖 and teachers 🤗. Exploring code together and learning programming along the way - yay!

#javascript #this #bind
Рекомендации по теме
Комментарии
Автор

What i really like about this channel is that those two guys are really representing a developer point of view. They don't edit their videos that much, because they don't want to appear like they are "perfect in everything". Instead, they leave their complete workflow unedited, and in that way other developers can see that learning is a process of committing errors and removing them after. So great to see this kind of natural way of learning and teaching, it is very rare on youtube where everyone wants to be percieved as "perfect". Much love and respect from Belgrade, Serbia.

codenameunknown
Автор

Thanks for clarifying - all my confusion just this-appeared!

bigexpectation
Автор

Thank you! David questioning everything is really helpful!

pavsoor
Автор

This is easily the best video on "this" ever. I've watched so many tutorials that just explain it at you and the information just doesn't stick with me. But they way you guys played around with it, testing things as you go, moving the function in/out of the object just to see what happens was really valuable. Also I know everyone else is saying it but David asking questions was great, and MPJ explaining things more the further we got was really helpful. Looking forward to the funfunfunction episode!

arsalmehran
Автор

I like the way when David gets the concept and re-explain it in his way, really liked his thinking. I would love to see like this video more, MPJ suggests a problem/topic and David & us figure out the solution.

shaikhahmaasher
Автор

That cool inline evaluation thing is called Quokka:

OfficialDevTips
Автор

I really love how you guys go through all the mistakes, talk about why someone could make them, and how to fix them.

andreicucea
Автор

This video is amazing, because it clearly demostrates how *this* works in Js, using a simple example. Also, David's questions are helpful, many of those I would have asked myself.

Probably the best video I've found on the topic! So thank you both! I've been following both DevTips and FunFunFunction for a while now, and I really admire your work!

davidvideauortega
Автор

Is it ever rewarding to watch an expert GET it. Eureka moments are wonderful. I love the way you guys work through this problem in a way that makes sense to YOU, which then makes sense to US.

iamlisaross
Автор

This was very informative, can we have more of this style where you break down some of the weird parts of JavaScript

hcmlopes
Автор

My goodness
I love it the way u guys did this. Thanks

iaml
Автор

This is really awsome, am happy you've taken again this subject and make it more like understandable for today, I remember watching one of your vids talking about this years ago and that was also awsome but that day and today javascript is not the same maybe the notion has changed i don't know

kawaentertainment
Автор

Let's say we have play.bind(obj). Method bind returns such a function, source code (code in its body) of which is identical to play function except 'this' keyword is changed to obj. I think it's a good explanation.

artihlec
Автор

```
const dragon = {
element: "fire",
breathe: somefunction.bind(dragon)
}
```
would that work?

DanielPersson
Автор

I would like to see a crossover between DevTips and Academind

ariell
Автор

The self loathing and self public shaming over thumbs up was hilarious =D

JacobMGEvans
Автор

18:43 it's so satisfying to watch the aha! moment!

HashimWarren
Автор

challenge: if you guys could do a async/await fetch or axios call to external api WITH a recursive retry (upon failure, like a 500 and a 401 response auth error) Added biscuits to be given if you can retry n times.. more fatty biscuits can be obtained with a time delay between each recursive call. (not a exp. backoff but just a 800ms delay) more trans fat fatty biscuits if you do it within 13 lines of code... added msg and sodium biscuits if you make it functional.

rickyu
Автор

Thank you very much for this episode, waiting for the next one!

ablgmv
Автор

This video on THIS is simply awesome... great great work.

zafarali