Returns the largest integer (whole number) less than or equal to a number.
Detect the preferred language of the current user
Use Navigator.language or the first value of Navigator.languages if available, otherwise return defaultLang.
Get the absolute value of a number with JavaScript
Get the absolute (positive) value of a number.
Return the scroll position of the current page
Use Window.pageXOffset and Window.pageYOffset if they are defined, otherwise Element.scrollLeft and Element.scrollTop.
Zoom an image
How to create an image zoomer which allows users to zoom an image using a range slider.
Format a number to a fixed number of decimal places
Format a number to a fixed number of decimal places. Pass in the number of decimal places as an argument
Retrieve the value of a CSS rule for the specified element
Use Window.getComputedStyle() to get the value of the CSS rule for the specified element.
Scroll to an element smoothly (smooth scroll)
We can scroll to given element smoothly (smooth scroll) by passing behavior: ‘smooth’.
Convert a string to a number
Sometimes it returns integer. Other times it returns a float. And if you pass in a string with random text in it, you’ll get NaN, an acronym for Not a Number.
Check if array has duplicates
Checks if there are duplicate values in a flat array. Use Set to get the unique values in the array.