Это видео недоступно.
Сожалеем об этом.
JavaScript this Keyword Explained Simply
HTML-код
- Опубликовано: 9 фев 2022
- In most cases, the value of 'this' is determined by how a function is called. 'this' usually refers to the object that is calling the current function. If a function, foo(), is called from the global scope ("foo()"), then 'this' will refer to the global object - the Window object. But if foo() is called from inside the scope of another object ("devsage.foo()"), then 'this' will refer to the object that is calling foo() - which is the 'devsage' object. Arrow functions don't provide their own 'this' binding so it inherits the 'this' value of the enclosing function.
📚Materials/References:
MDN Web Docs: developer.mozilla.org/en-US/d...
🌎 Find Me Here:
Twitter: / realdevsage
Discord: / discord
Ebooks: payhip.com/devsage
Merch: cottonbureau.com/people/devsage
💙 Twitter: twitter.com/realDevSage
📙 Ebooks: payhip.com/devsage
💥 Discord: discord.gg/BP8wPv6raA
👕 Merch: cottonbureau.com/people/devsage
Seriously great explanation! Came here for more clarification on it after The Odin Project lesson Objects and Object Constructors
Same haha
'This' references to the object that calling the function.
This simple sentence cleared my mind after reading a lot of stuff about 'this'. Your explanation is amazing!!
Appreciate all your useful vids. They've substantially benefited me in the first couple months I started out.
I've been struggling to fully comprehend this; your video really helped me out. Looking forward to checking out more of your vids ;)
Amazing explanation, much more concise than articles I've read.
Glad it helped!
i really want to say thank you because your simple explanation made me get it finally
Thanks a lot. One of the clearest explanations of `this`. 🔥
No problem, Aruna!
Very clear explanation ..
Great explanation, thank you!
Great explanation, thanks!
Very clean explanation, thanks for that!
No problem!
Very nicely explained. Thanks
No problem!
Very good and instructive explanation
Bro, that arrow function confused me while reading an article T - T. Thanks man!
Happy to help!
Finally someone that doesn't speak overly fast
was very helpful, thanks ..
You're welcome!
Is it possible to import any module without writing the module type and export it
Thanks!
best video on this topic! ty.
No problem!
you are a legend
best tutorial on "this" subject
Thanks!
a big thumb up for you, thank you!
9:53 Could you just use an arrow function with the forEach method/function to solve the "this" problem?
Yes!
So, could we say that using inline functions with the `this` keyword is discouraged (bad practice) since it would require it being nested within a normal function?
Meaning that instead of using an inline and nesting it, It's better to simply just use a normal function? Please correct me if I am mistaken! :)
Correct.
this is awesome
Thank you
I am okey with this topic but, i have a question. When i use this keyword on a object literal like 'fullName : this' it says it is a global object and this kind of little things confuses me. Thank you.
I subscribed because i was able to understand "this"
Thanks!
on forEach (8:02) when this refers to window object why dont we use arrow function for ex: this.hobbies.forEach((hobby)=>{ ( console.log( this.firstName )} ));
You can, i guess he just wanted us to learn how to fix it without changing the callback function type.
Right , but its more interesting to do that way for the sake of concept and learning isnt ?