JavaScript Snippets
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.
Learn how to use the JavaScript ES6 spread syntax to converting iterables to arrays and level up your code today.
If you need to check if Caps Lock is on when the user is typing in the browser, JavaScript's got you covered.
Learn how JavaScript handles mutable data, such as objects and arrays, and understand how shallow cloning and deep cloning work.
Groups the given data into
k
clusters, using the k-means clustering algorithm.Accessibility (a11y) can improve your website and attract new users. Learn how to get started with these 8 quick tips.
Learn all of the options JavaScript provides for modifying the URL of the current page in the browser without reloading the page.
Retrieves a set of properties indicated by the given selectors from an object.
Returns the human-readable format of the given number of milliseconds.
Learn all the different ways you can implement a
sleep()
function in JavaScript.Learn everything you need to know about the conditional (ternary) operator and how to use it in JavaScript.
JavaScript's
this
keyword is a source of confusion for many beginners and veterans alike. Learn how it works in different scenarios and start using it correctly.Ever wanted to get the value of an HTML input element as a number? Learn an easy way to do it with this handy trick.
Creates an object containing the parameters of the current URL.
Classifies a data point relative to a labelled data set, using the k-nearest neighbors algorithm.
ESLint is a very powerful tool that can save you a lot of headaches, but sometimes it gets in the way. Learn how to refactor code to get rid of a common warning.