I have the following code...
function foo(type) {
if(foo.type == undefined) foo.type = 0;
}
What I'd like it to do is create a new property on the foo
object for each "type" that comes through and set that property to zero (and later begin counting each time a "type" comes through). However, I hit a mental blip, in this case foo.type
is probably evaluated as the property type
, on foo
and not whatever the variable type
refers to.
I need to convert the value of type
to a property, any ideas?
And yes I know this question's name sucks, if you think of something better just edit the quesiton.