There should be blank lines. But using type conversion:
if(window.location.search)
will work anyway. If a search is given, it will definitely be an empty string and then true will be evaluated.
Or use typeof:
if(typeof window.location.search === "string")
but this is also true for an empty string. It depends on what you want to do at the end.
source
share