jquery - Cant grab indexOf - is not a function -
i have array want store name , piece of information can call item retrieve information. when try search array check first item in array receive: genrearray.indexof not function
my code:
var genrearray = {"00's":"includes amy whinehouse, westlife, killers...","90's":"includes britney spears, backstreet boys, mariah carey..."}; if(genrearray.indexof("00's") > -1) //crashed here { //code here console.log(genrearray["00's"]); }
genrearray
object, object contains key/val pairs, not indexes. can hasownproperty
if (genrearray.hasownproperty("00's")) { }
(so might make sense rename variable 'genreobj')
Comments
Post a Comment