I am trying to find an equivalent function for Javascript. What I'm trying to do is look for the current url, and if it has the next first part of the url, do something.
In PHP, I have this
if (substr_count($current_url, $root . $_SERVER['SERVER_NAME'] . '/shop/shop-gallery') {
doSomething();
}
So, if it matches this URL and all additional URLs like / shop / shop -gallery / product1..etc, the statement will be true.
Now, how can I execute the exact same statement in javascript?
Thanks guys!
user381800
source
share