Assume I have an object:
var obj = {
foo:"bar",
fizz:"buzz"
};
I need to access a property of that object dynamically like so:
var objSetter = function(prop,val){
obj[prop] = val;
}
No problems there, except for that prop
needs to be case insensitive in case the property name is passed into the function as, say, Foo
instead of foo
.
So how can I point to an object's property by name without regard to case? I would like to avoid iterating the entire object if possible.