Lets say i have this code:
function GetParentObject(fn){
//get parent object from function
}
var obj = GetParentObject(eval); //returns window
How do i implement GetParentObject function?
Lets say i have this code:
function GetParentObject(fn){
//get parent object from function
}
var obj = GetParentObject(eval); //returns window
How do i implement GetParentObject function?
This is where this
comes in.
The this
keyword returns the object that owns the function where it is called.