lundi 2 mars 2015

Javascript What method should I use to find or check if a string exists in an array?

I found these methods, indexOf() apparently doesn't work for internet explorer 8


There are a lot of options, I want to know which one is like the defacto or what I should opt to use for best results.


Also, if the result is undefined, how do I use that as a value do I simply use it as a string like "undefined" or is it null?



array.find()
array.findIndex()
array.indexOf("string");

Aucun commentaire:

Enregistrer un commentaire