The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
JavaScript, Browser
Detects whether the page is being viewed on a mobile device or a desktop.
JavaScript, Math
Calculates the distance between two points.
JavaScript, Function
Logs the name of a function.
JavaScript, Array
Checks if all the elements in values
are included in arr
.
JavaScript, Array
Checks if at least one element of values
is included in arr
.
JavaScript, Array
Initializes and fills an array with the specified values.
JavaScript, Browser
Inserts an HTML string after the end of the specified element.
JavaScript, Browser
Inserts an HTML string before the start of the specified element.
JavaScript, Type
Checks if the given argument is a function.
JavaScript, Math
Checks if the provided integer is a prime number.
JavaScript, Browser
Checks if the user color scheme preference is dark
.
JavaScript, Browser
Checks if the user color scheme preference is light
.
JavaScript, Browser
Removes an element from the DOM.
JavaScript, Browser
Checks if touch events are supported.
JavaScript, String
Truncates a string up to a specified length.