better to wrap the whole thing in an IIEFE and return early after the feature detect.
then define the global if you need to.
cleaner.