Javascript: indexOf -
i using following code search value in string.
if (myvalue.indexof("call") > -1) { //dosomething }
how can , or?
(myvalue.indexof("call" || "data") > -1)
the following works;
if (myvalue.indexof("call") > -1 || (myvalue.indexof("data") > -1) ) { //dosomething }
but thought there easier way?
this way :
myvalue.match(/(call)|(data)/ig)
Comments
Post a Comment