Detecting browser vs. Node environment
From here:
const isBrowser = new Function( "try { return this === window } catch(e) { return false }", ) console.log("is browser:", isBrowser())