mercredi 18 février 2015

JavaScript object check for key -- but ignore case


Normally, I would do it like this



if (key in obj) {
//other stuff
}


But I don't actually know that they are capitalized the same. What's the best way to do this? I would rather not iterate through the whole array, calling .toLowercase on each key in the object, but is that the only option?





Aucun commentaire:

Enregistrer un commentaire