I would like to pass a parameter to a function that is used as an actual piece of code
this.illuminateLeg = function(whom) {
var propertiesToIlluminate = [], prop, illuminateInternal, i = 0, delay = 100, intervalId;
for (key in this.whom.zoom) {
propertiesToIlluminate.push(this.whom.zoom[key]);
}
}
I am trying to pass a whom parameter that is used to iterate over whom properties of my object.
I know its possible to pass strings as arguments, but how about actual pieces of code?
Is it possible to do so?
this, but you want to get property name fromwhomargument? Then use square bracket syntax, as suggested in answer below. Or you want to pass function ("piece of code") as argument? Then just pass it.