Use the greater than (>) and less than (<) operators to check if date is between dateStart and dateEnd.
Get the Children of an Element
To get the children of an element, you use the childNodes property of the element.
Scroll to an element smoothly
This snippet produces a smooth scrolling implementation which also allows us to customize the animation effect and duration.
Scroll to top of the page
Utilizing this snippet, you can add a button at the bottom of page that allows user to scroll to the top quickly.
Check if the browser tab of the page is focused
Use the Document.hidden property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.
Get Siblings of an Element
This snippet gets the next sibling and previous sibling of an element, using the element.nextSibling and element. previousSibling properties.
Generating random numbers with JavaScript
In this snippet, look at how to get a random integer between two numbers.
Get size of the selected file
This snippet can be used to validate a file’s size and display it, for instance when a file is being submitted for upload.
Check if the given number is even
Check whether a number is odd or even using the modulo (%) operator. Return true if the number is even, false if the number is odd.
Get the Parent of an Element
This snippet gets the parent of an element by using the parentNode property of the element.