JavaScript Browser Snippets
The JavaScript snippet collection contains a wide variety of ES6 helper functions. Browser snippets include helper functions for selecting, traversing, and manipulating DOM elements, while general-purpose helpers can be found in the JavaScript snippet collection.
Level up your JavaScript logging with these
console.log()
tips and tricks.If you need to check if Caps Lock is on when the user is typing in the browser, JavaScript's got you covered.
Learn the differences between JavaScript ES6 arrow functions and regular functions and how they affect event listener callbacks.
Learn how to programmatically copy text to clipboard with a few lines of JavaScript and level up your web development skills.
Learn all of the options JavaScript provides for modifying the URL of the current page in the browser without reloading the page.
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.
Copies a string to the clipboard. Only works as a result of user action (i.e. inside a
click
event listener).Creates a hash for a value using the SHA-256 algorithm. Returns a promise.
Converts an
hsl()
color string to an object with the values of each color.Converts an
rgb()
color string to an object with the values of each color.Learn how to attach an event handler to events that is executed at most once in this JavaScript blog post.
Changes the lightness value of an
hsl()
color string.Parses an HTTP Cookie header string, returning an object of all cookie name-value pairs.
Runs a function in a separate thread by using a Web Worker, allowing long running functions to not block the UI.