Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 20, 2021 05:57 am GMT

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.
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!


Original Link: https://dev.to/chetan_atrawalkar/most-confusing-part-of-javascript-3d80

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To