JS - To check URL contains multiple strings

0 votes
895 views
added Jun 13, 2019 in Javascript by LC Marshal Captain (25,790 points)
if(url.indexOf(newsContent) > -1 || url.indexOf(searchCat) > -1) {
  //do nothing
}
// else if(url.indexOf(searchCat) > -1) {
//   //do nothing
// }
else {
  element.classList.add("active");
}

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...