DEV Community

Discussion on: 7 Killer One-Liners in JavaScript

Collapse
 
martinpham profile image
Martin Pham

1) It will lead to another problem: When navigator.clipboard is not available, the Promise.reject will be called, and probably you won't know: TypeError will be thrown (spec 25.4.4.4)
2) I'm not sure why using globalThis instead of window here btw

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Point 2 is especially true

matchMedia will never be isomorphic, such recommendations appear to be blanket.

globalThis was not the original way to reference global and will still break some browsers unless a global.globalThis = global where global is window nor global, is referred to as a polyfill.

Thread Thread
 
martinpham profile image
Martin Pham

Correct!