JavaScript this Keyword

1/22/2020 4:58:32 AM

In the JavaScript have this keyword. This keyword basically referees the won property. When we call this keyword then we use the property which is present under the scope. When we use the same name as a variable one is present under a scope and another is out of scope then how can identify which is under the scope and which is the out of the scope. Now we use this keyword to identify. When use this keyword then this is the under the scope variables. Also, when we use this keyword then it prefers object won property. Now given bellow the example code and explain the code:

<!DOCTYPE html>
<script type="text/javascript">
// JavaScript this keyword
let myProparty={
  console.log("Yes i can do!");
  //use this keyword

In this JavaScript code we see how to work this keyword. When we use this keyword into our object under “console.log” function then this keyword represents our own property of the object. So, we can say this keyword represent the won property of the object or which scope under present.