Home & blog

Fun with JavaScript's spread (...) operator

15 Aug 2021 javascript

JavaScript's spread operator (...) landed in ECMAScript version 9, and has some really useful applications. It's essentially a way to unpack strings, arrays or objects into their constituent parts.

JavaScript maps and sets part 2: Weak maps

1 Jan 2021 maps javascript

In part two of this in-depth guide to JavaScript maps and sets we'll be looking at the weird, exotic world of weak maps. These are like maps, except the keys are always objects and the entries are "weakly held". We'll explore just what this means.

JavaScript maps and sets part 1: Maps

15 Dec 2020 maps javascript

In this guide we'll be looking at JavaScript maps and sets. First up, maps, which are a sort of super object. They work like objects, but with some key differences and improvements - most notably, they have a reliable order and can accesspt any data type as keys!

Simulating jQuery's on() method

8 Nov 2020 jquery javascript

Following up on my recent guide to JavaScript event delegation, I thought it would be interesting to simulate jQuery's on() method, which makes event delegation a breeze by hiding its workings, in native JS.

Event delegation in JavaScript

1 Nov 2020 performance events javascript

Event delegation is a great pattern to learn in JavaScript - yet it's still alien to many beginner/intermediate developers. Let's see how it works, and why you need to be using it. We'll even make our own jQuery-style on() method.

Introducing Promice.any()

2 Aug 2020 promises javascript

Meet Promise.any(), which is supported by the just-released Firefox 79. It's like Promise.race(), except it listens only for the first promise to be fulfilled, not merely resolved either way.

Resolving JavaScript promises from outside

16 Feb 2020 promises javascript

When the JavaScript Promises specification was released, one of the first questions that got asked (and is still asked) was: but how do I resolve them from outside, a la jQuery deferred objects? That's not how they're intended to work, but it is possible.

How relevant is jQuery in 2020?

8 Jan 2020 jquery javascript

jQuery took the world by storm. It filled in the gaps of JavaScript's then rather sparse API, and made coding MUCH simpler. But the JavaScript API has moved on, and reactive frameworks are the naem of the game. How relevant still is jQuery?

JavaScript Promises part 1: Meet promises

31 Jul 2019 promises javascript

Promises a great way to write shallow, readable code that looks synchronous but actually hides away asynchronous operations. In this first of three articles I'll be showing you how they work, and what problem they solve.

JavaScript generators part 1: Generator basics

25 Feb 2019 generators javascript

Welcome to JavaScript generators! In this article, the first in a three-part guide, I'm going to be introducing the basics of genereator functions, what they're about, how you can use them and give a hint to their deeper capabilities that we'll meet later in the series.