Even shorter, thanks to short-circuiting, is const nav = chrome || browser; which also allows for more legible chaining past two items - such as falling back to a polyfill or nullobject.
Particularly useful if certain functions may require optional permissions.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Even shorter, thanks to short-circuiting, is
const nav = chrome || browser;
which also allows for more legible chaining past two items - such as falling back to a polyfill or nullobject.Particularly useful if certain functions may require optional permissions.