Added content to Javascript This keyword (#1990)
* blank spaces removed in existing files * Added content to javascript this keyword * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/100-function-borrowing.md * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/100-function-borrowing.md * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/100-function-borrowing.md * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/102-this-in-a-function.md * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/103-using-this-alone.md * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/104-this-in-event-handlers.md * Update content/roadmaps/106-javascript/content/111-javascript-this-keyword/105-this-in-arrow-functions.md Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>pull/2136/head
parent
7f2a180a9e
commit
6bad088306
14 changed files with 38 additions and 32 deletions
@ -1 +1,8 @@ |
||||
# This in a function |
||||
# this in a function |
||||
|
||||
The keyword `this` when used in a function refers to the global object. |
||||
|
||||
*Note: in a browser window the global object is the `window` object.* |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.w3schools.com/js/js_this.asp'>this in a function</BadgeLink> |
@ -1 +1,8 @@ |
||||
# Using this alone |
||||
|
||||
The keyword `this` when used alone refers to the global object. |
||||
|
||||
*Note: in a browser window the global object is the `window` object.* |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.w3schools.com/js/js_this.asp'>this Alone</BadgeLink> |
@ -1 +1,6 @@ |
||||
# This in event handlers |
||||
# this in event handlers |
||||
|
||||
The keyword `this` when used in an event handler refers to the element that received the event. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://www.w3schools.com/js/js_this.asp'>this in Event handlers</BadgeLink> |
@ -1 +1,6 @@ |
||||
# This in arrow functions |
||||
# this in arrow functions |
||||
|
||||
The keyword `this` when used in an arrow function refers to the parent object. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://stackoverflow.com/questions/66518020/javascript-this-keyword-and-arrow-function'>this keyword and arrow function</BadgeLink> |
@ -1,11 +1,7 @@ |
||||
# Explicit binding |
||||
|
||||
In this method, you can force a function to use a certain object as its this. Explicit Binding can be applied using call(), apply(), and bind(). |
||||
|
||||
call(): Pass in the required object as the first parameter during the function call. The actual parameters are passed after the object. |
||||
|
||||
apply(): Similar to call() with a difference in the way the actual arguments are passed. Here, the actual arguments are passed as an array. |
||||
|
||||
bind(): In this method, you create a new function with a fixed this. These types of functions created using bind() are commonly known as bound functions. |
||||
Explicit binding is when you use the `call` or `apply` methods to explicitly set the value of `this` in a function. Explicit Binding can be applied using `call()`, `apply()`, and `bind()`. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://medium.com/swlh/javascript-this-ac28f8e0f65d'>Explicit Binding</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://medium.com/@msinha2801/explicit-binding-rule-for-this-keyword-in-js-712405b0a11'>Explicit Binding rule for this keyword</BadgeLink> |
||||
|
Loading…
Reference in new issue