Travis build: 1831

This commit is contained in:
30secondsofcode
2018-03-19 14:51:39 +00:00
parent a0c20dc503
commit 98abde9915
3 changed files with 34 additions and 4 deletions

View File

@ -8,10 +8,10 @@ browser environment unless they were explicitly defined), which will return `tru
`typeof` allows globals to be checked for existence without throwing a ReferenceError. If both of them are not `undefined`, then the current environment is assumed to be a browser.
```js
const isBrowser = () => ![typeof window, typeof document].includes('undefined')
const isBrowser = () => ![typeof window, typeof document].includes('undefined');
```
```js
isBrowser() // true (browser)
isBrowser() // false (Node)
isBrowser(); // true (browser)
isBrowser(); // false (Node)
```