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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -