Maybe url.indexOf('?') !== -1 or url.search(/\?/g) !== -1 makes it clearer of what you are trying to do.