Update this keyword in JavaScript roadmap (#1660)

pull/1666/head
Jozias Martini 2 years ago committed by GitHub
parent 3fc4bcac31
commit c738a2844c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      content/roadmaps/106-javascript/content/111-javascript-this-keyword/readme.md

@ -1 +1,14 @@
# Javascript this keyword
# This Keyword
In JavaScript, the `this` keyword is a little different compared to other languages. It refers to an object, but it depends on how or where its being invoked. It also has some differences between strict mode and non-strict mode.
- In an object method, `this` refers to the object
- Alone, `this` refers to the global object
- In a function, `this` refers to the global object
- In a function, in strict mode, `this` is undefined
- In an event, `this` refers to the element that received the event
- Methods like call(), apply(), and bind() can refer `this` to any object
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.w3schools.com/js/js_this.asp'>The JavaScript `this` Keyword</BadgeLink>
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this'>This Keyword</BadgeLink>

Loading…
Cancel
Save