AFAIK "this" is used when there is clash between "property" & "parameter" of function.
Please find my code below.
<script>
function person(firstName, lastName, age, eyeColor) {
this.firstName = firstName;
this.lastName = lastName;
this.fullName = function() {
return this.firstname + " " + this.lastname
}
}
var p = new person();
document.write("fullname is " + p.fullName());
</script>
Here please correct me if I am wrong with following things
this.firstName contains "this" because person contains firstName as parameter and wants to be as property of person.
My doubt is that this.fullName also has "this" in it even thought there is no parameter with fullName.May be I am wrong(Read that "this" actually creates an instance).
If above is true that it actually creates an instance then my problem is it is creating instance in varp = new person()
and why would we create instance offullName
property inside of person