3 ms·
I agree, though I'd settle for: `if (stripe && stripe.handleCardPayment)` (I know the behaviour isn't identical, but checking the actual type is pointless in
by cnity 5y ago
I agree, though I'd settle for:
`if (stripe && stripe.handleCardPayment)`
(I know the behaviour isn't identical, but checking the actual type is pointless in this case)
- 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!