I have this function which does things to something in an object:
which seems nice and clean. But if there is more than one argument, I can end up doing stuff like this:Code:dostuff(p) { for (prop in Thing) if (prop == p) Thing[prop].className = 'x'; }
If there is more than one argument, should I just be using a "normal" for loop:Code:dostuff(a,b,c) { for (prop in Thing) if (prop == a || prop == b || prop == c) Thing[prop].className = 'x'; }
? Or is there some other thing that one can do that I'm missing?Code:dostuff() { for (var i = 0; i < arguments.length; i++) Thing[arguments[i]].className = 'x'; }






Bookmarks