Let's say I have a Person object with properties age, name, and height I have a function called adjustProperty that takes in two paramaters, one is a reference to a Person's property and then to a value to change that property to...so if I do this:
Tom.adjustProperty("age", "20");
It changes Tom's age to 20...
So...how do I actually refer to the property inside the function call, if it is defined as so:
function adjustProperty(prop, val){
this.prop = val; //i take it, this does NOT work
}
Tom.adjustProperty("age", "20");
It changes Tom's age to 20...
So...how do I actually refer to the property inside the function call, if it is defined as so:
function adjustProperty(prop, val){
this.prop = val; //i take it, this does NOT work
}