Currently browsing JavaScript Arrays & Objects
Work confidently with the two workhorses of JavaScript data: arrays and objects. Tutorials cover mapping, filtering, reducing, sorting, destructuring, and transforming data structures cleanly and efficiently. Learn the patterns and methods that make manipulating collections in JavaScript fast and readable.
Enhancing <select> Dropdowns: Removing Duplicates and Sorting Options with Vanilla JavaScript
When working with <select> dropdowns in HTML, it’s common to encounter scenarios where you need to remove duplicate options or…
Sorting and Ordering Elements Based on Data Attributes with Vanilla JavaScript
Sorting elements on a webpage can be a critical feature when you need to reorder content dynamically. Whether it’s based…
Sort Elements Based on Data Attributes with Vanilla JavaScript
In a recent project, I was tasked with sorting a large list of elements dynamically based on multiple data attributes.…
Dropdown Autocomplete with contenteditable Fields
Autocomplete for contenteditable Fields Using Vanilla JavaScript If you’ve ever needed to implement autocomplete functionality in a contenteditable field or…
Calculating Mean, Median, and Mode in JavaScript
When dealing with statistics, three key measures often come into play — mean, median, and mode. These statistical metrics help…
Grouping Arrays in JavaScript with Object.groupBy() and Map.groupBy()
In JavaScript, there often arises a need to group array elements based on a certain property. Prior to ES2024, this…
Check DNS records in bulk using JavaScript
If you’re a web developer or network administrator, you know that DNS records play a crucial role in ensuring that…
Code Golfing Tips & Tricks: How to Minify your JavaScript Code
JavaScript golfing is the process of writing the smallest amount of JavaScript code to do something awesome.
The Complete JavaScript Strings Reference
JavaScript strings are deceptively complex constructs. There are actually two different types of strings – string Literals and string Objects…
How to code your own JavaScript de-duplicator
I have a new tool on getButterfly: a data de-duplicator for emails, URLs, IDs, names and more. It's written in…
How to create a simple JavaScript percentage graph (or chart)
This small JavaScript snippet creates percentage graphs out of raw (array) data. Just input the name/value pairs of the involved…
JSONify Dropdown Element Using Vanilla JavaScript
This function converts a regular <select> element both into an intented ul/li structure and JSON. It’s light and it’s been…
JavaScript Data Types
Every variable in JavaScript has a data type which dictates the values that can be stored in it. However, JavaScript…
A JSON Overview
JavaScript Object Notation, or JSON, is a plain text data interchange format. It is based on a subset of the third…
Native Browser Support for JSON
JavaScript Object Notation, or JSON, is a text format used to represent JavaScript objects as strings. Like other text formats,…
Self Documenting Flexible Parameters
When managing function parameters, it’s often more maintainable to use an options object. This allows you to pass a single…
Generate HTML List From JavaScript Array
Generate an HTML list based on the contents of a JavaScript array. By modifying the makeList() function to accept parameters…