?Most Confusing Part Of JavaScript.

If you are working with javascript for a while, you will agree with me. This ‘this’ keyword is very confusing when you are writing code, especially when you read others code.

This may be controversial, but for me it’s the this keyword.

➡️ this has a…


This content originally appeared on DEV Community and was authored by Chetan Atrawalkar?CA.

If you are working with javascript for a while, you will agree with me. This ‘this’ keyword is very confusing when you are writing code, especially when you read others code.
confused

This may be controversial, but for me it's the this keyword.

➡️ this has a different values depending on where it is used.
➡️ Inside a method this refers to the owner object.
➡️ When alone this refers to the global object.
➡️ Inside a function this
this refers to the global object too.
➡️ In a function, in strict mode this is undefined.
➡️ In a event this refers to the element that received the event.

However, since 2019 I've been using React Hooks, I haven't had to use the this keyword once.
hooks

Learn More About React Hooks On official website.
React Hooks.

Do you like React Hooks too?
Let's discuss it more in the comments section. If you agree don't forget to like ❤️ and save ?

?Keep Focused And Just Code It!


This content originally appeared on DEV Community and was authored by Chetan Atrawalkar?CA.


Print Share Comment Cite Upload Translate Updates
APA

Chetan Atrawalkar?CA. | Sciencx (2021-07-20T05:57:51+00:00) ?Most Confusing Part Of JavaScript.. Retrieved from https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/

MLA
" » ?Most Confusing Part Of JavaScript.." Chetan Atrawalkar?CA. | Sciencx - Tuesday July 20, 2021, https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/
HARVARD
Chetan Atrawalkar?CA. | Sciencx Tuesday July 20, 2021 » ?Most Confusing Part Of JavaScript.., viewed ,<https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/>
VANCOUVER
Chetan Atrawalkar?CA. | Sciencx - » ?Most Confusing Part Of JavaScript.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/
CHICAGO
" » ?Most Confusing Part Of JavaScript.." Chetan Atrawalkar?CA. | Sciencx - Accessed . https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/
IEEE
" » ?Most Confusing Part Of JavaScript.." Chetan Atrawalkar?CA. | Sciencx [Online]. Available: https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/. [Accessed: ]
rf:citation
» ?Most Confusing Part Of JavaScript. | Chetan Atrawalkar?CA. | Sciencx | https://www.scien.cx/2021/07/20/%f0%9f%a7%90most-confusing-part-of-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.