Javascript string index -
i working on javascript on website helps companies see how campaigns doing on 1 collective screen. using if statement separate of information when go check code says
string index out of range -1
here sample code:
var place = {media buy name}; if(place.indexof("prospecting")){ return "prospecting"; } else if(place.indexof("audiencetargeting")){ return "audiencetargeting"; } else if(place.indexof("retargeting")){ return "retargeting"; } else{ return "other"; }
1) javascript case-sensitive. indexof
not same indexof
.
2) array
, string
have indexof
method (1, 2). place
plain object, has no indexof
method, neither indexof
.
therefore have make place
variable either array
or string
. code work.
Comments
Post a Comment