This is just a simple example of what I'm trying to do:
switch (window.location.href.contains('')) { case "google": searchWithGoogle(); break; case "yahoo": searchWithYahoo(); break; default: console.log("no search engine found");}
If it's not possible/feasible what would be a better alternative?
Solution:
After reading some of the responses I found the following to be a simple solution.
function winLocation(term) { return window.location.href.contains(term);}switch (true) { case winLocation("google"): searchWithGoogle(); break; case winLocation("yahoo"): searchWithYahoo(); break; default: console.log("no search engine found");}