115
rated 0 times
[
117]
[
2]
/ answers: 1 / hits: 85689
/ 12 Years ago, tue, september 18, 2012, 12:00:00
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.
More From » object