3 ms·
`if (window.stripe && stripe.handleCardPayment)`; just `stripe` may throw a ReferenceError if not loaded, while `window.stripe` will be `undefined` (appropriate
by chrismorgan 5y ago
`if (window.stripe && stripe.handleCardPayment)`; just `stripe` may throw a ReferenceError if not loaded, while `window.stripe` will be `undefined` (appropriately falsy) if not loaded.
(This is assuming a browser environment, where `window` is roughly the global object; see also `globalThis`, especially for further reading on how unfortunately complicated the whole situation is.)
- cnity 5y agoGood catch!