Reputation: 21
So I have a bit of a problem. I don't remember how to use the /*
in JavaScript like after the URL
example.
if(URL == "www.thing.com/"){}
So I don't remember were to place the /*
to make it so it's not just "www.thing.com"
but every other thing that comes after that, for example "www.thing.com/questions/..."
.
Would it just be "www.thing.com/*"
?
Upvotes: 1
Views: 51
Reputation: 288120
*
in a string doesn't do magic.
You can use String.prototype.indexOf
:
var URL = "www.thing.com/foo/bar";
if(URL.indexOf("www.thing.com/") === 0){ /* this is executed */ }
or, if you want a more flexible wildcard, use regular expressions.
Upvotes: 4