Little Bits: JavaScript’s Array reduce()

Here’s a quick intro to a bit of code that I love: JavaScript’s Array reduce(). reduce is a function that takes an array of items in JavaScript and transforms it into a single item. A user-defined function is provided that dictates how the final value is calculated as the reduce function goes through each item in the array. For example, you can write a simple sum function with a reducer by keeping a running total of the values in the array like so:

[1, 2, 3, 4, 5].reduce((acc, curr) => acc + curr);
// -> 15
An animation of the reducer in action

The reduce function can be used for all kinds of operations, including chaining together sequential async calls based on an array. To learn more, check out the video below:

Building a Qlik Sense Extension – A Video Breakdown

Over the last month and a half, I have launched a couple of video channels where I will be explaining different web development concepts while live coding. My goal is for people to see not only how to do something, but also to see how challenges arrive, methods for debugging them, etc.

To follow along in real time, follow the broadcasts on the Twitch channel. The videos are all archived on my YouTube channel.

The first set of videos I’ve posted is a 3-parter on building a Qlik Sense Extension from scratch. I hope they will help people new to the extension game get a sense of what it takes to build one from end to end.

Enjoy!