This keyword is used in different places.
Cases :
Outside a Function or object : it represents the window object.
Inside the object, it represents the current object.
Example -1 :
const data = {
name: "shivaj
displayName(){
console.log(this.name);
}
}
data.displayName(); //Shivaji
Example -2:
const data = {
name: shivaji
anotherName : {
name2 : "vyshu"
displayName(){
console.log(this.name2, " And " , this.name );
}
}
}
data.anotherName.displayName() //Vyshu and undefined