The regex way:
var matches = !!location.href.match(/franky/); //a boolean value now
Or in a simple statement you could use:
if (location.href.match(/franky/)) {
I use this to test whether the website is running locally or on a server:
location.href.match(/(192.168|localhost).*:1337/)
This checks whether the href contains either 192.168
or localhost
AND is followed by :1337
.
As you can see, using regex has its advantages over the other solutions when the condition gets a bit trickier.