You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consttimeFromDate=date=>date.toTimeString().slice(0,8);console.log(timeFromDate(newDate(2021,0,10,17,30,0)));// Result: "17:30:00"console.log(timeFromDate(newDate()));// Result: will log the current time
constelementIsInFocus=(el)=>(el===document.activeElement);elementIsInFocus(anyElement)// Result: will return true if in focus, false if not in focus
9. Check if the current user has touch events supported
consttouchSupported=()=>{('ontouchstart'inwindow||window.DocumentTouch&&documentinstanceofwindow.DocumentTouch);}console.log(touchSupported());// Result: will return true if touch events are supported, false if not
10. Check if the current user is on an Apple device
constisAppleDevice=/Mac|iPod|iPhone|iPad/.test(navigator.platform);console.log(isAppleDevice);// Result: will return true if user is on an Apple device
11. Scroll to top of the page
constgoToTop=()=>window.scrollTo(0,0);goToTop();// Result: will scroll the browser to the top of the page