What is this keyword in OOP

What is “this”?

You may have noticed something slightly strange in our methods. Look at this one for example:

greeting: function() { alert('Hi! I\'m ' + this.name.first + '.'); }

You are probably wondering what “this” is. The this keyword refers to the current object the code is being written inside — so in this case this is equivalent to person.

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.