Skip to content

Instantly share code, notes, and snippets.

@WouterNieuwerth
Last active March 13, 2020 19:01
Show Gist options
  • Save WouterNieuwerth/72a137c3bd97bb8b7d8afa8fa1dfd738 to your computer and use it in GitHub Desktop.
Save WouterNieuwerth/72a137c3bd97bb8b7d8afa8fa1dfd738 to your computer and use it in GitHub Desktop.
var search_terms = ['buy nike shoes','adidas online','rebok cloths']; // With some spelling errors
var brands = ['nike','adidas','reebok'];
for (var i=0; i<search_terms.length; i++) {
for (var j=0; j<brands.length; j++) {
if(search_terms[i].indexOf(brands[j]) !== -1) {
// Do whatever you want to do when the search term contains a brand name
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment