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.
Pads a string on both sides with the specified character, if it's shorter than the specified length
.
JavaScript, String · Oct 22, 2020
Returns all elements in an array except for the first one.
JavaScript, Array · Oct 22, 2020
Truncates a string up to specified length, respecting whitespace when possible.
JavaScript, String · Oct 21, 2020
Learn how to detect undefined
object properties in JavaScript the correct way.
JavaScript, Object · Aug 7, 2022
Attempts to invoke a function with the provided arguments, returning either the result or the caught error object.
JavaScript, Function · Oct 18, 2020
Detects whether the page is being viewed on a mobile device or a desktop.
JavaScript, Browser · Oct 22, 2020
Checks if the provided value is an object created by the Object constructor.
JavaScript, Type · Oct 20, 2020