Use Math.random() to generate a random 24-bit (6 * 4bits) hexadecimal number.
Generate a random number in a given range with JavaScript
The following snippet returns a random number between min (inclusive) and max (exclusive).
Add items to an array in JavaScript
Add items to an array. Pass the new items in as arguments.
Smooth Scroll to the Top of the Page With JavaScript
Get distance from top using Document.documentElement or Document.body and Element.scrollTop.
Get the largest number from a set of numbers
Math.max() returns the largest number from a set of numbers. Pass each number in as an argument.
Remove HTML/XML tags from a string
Use a regular expression to remove HTML/XML tags from a string.
Return the largest integer less than or equal to a number
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.