supportsTouchEvents
Checks if touch events are supported.
- Check if
'ontouchstart'exists inwindow.
const supportsTouchEvents = () =>
window && 'ontouchstart' in window;supportsTouchEvents(); // true
Checks if touch events are supported.
'ontouchstart' exists in window.const supportsTouchEvents = () =>
window && 'ontouchstart' in window;supportsTouchEvents(); // true