Home & blog

Exploring advanced use of template refs in Vue

21 Dec 2023 vue

Vue's template refs allow us access to native DOM elements. But there's a few cases where their usage is a bit more complex, like using them in v-for loops or on child components. Let's take a look!

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 javascript maps

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 javascript maps

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 javascript jquery

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 events javascript performance

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 Promise.any()

2 Aug 2020 javascript promises

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 javascript promises

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 these days?

8 Jan 2020 javascript jquery

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

28 Jun 2019 javascript promises

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.