Note: किसी function में किसी object ke property को call करने के this.object_property_name का use किया जाता है
// Ex 1 : Program(with function & using without this keyword)
<script>
var a = {
fname : ["Ram", "suresh", "Ganesh"],
lname :["Kumar", "Singh", "Gupta"],
fullname: function myfunc(){
return a.fname[1]+" " +a.lname[1]
}
}
document.write(a.fullname());
</script>
// ex 2 : Program(with function & using with this keyword)
<script>
var a = {
fname : ["Ram", "suresh", "Ganesh"],
lname :["Kumar", "Singh", "Gupta"],
fullname: function myfunc(){
return this.fname[1]+" " +this.lname[1]
}
}
document.write(a.fullname());
</script>