Quick Tip: JavaScript Partially Applied Functions

Say we have the following function:

<code class="javascript">
function increaseBy(x){
return function(y){
return x + y;

We can use this function to create new, higher order functions that increase a number by a certain value.

for example:

<code class="javascript">
var incByThree = increaseBy(3);

gives us a function we can then use later in our code as such:

<code class="javascript">
//returns 7
//returns 8

We can also create multiple higher-order functions and have each of them use a different x value;

<code class="javascript">
var incByThree = increaseBy(3);
var incByFour = increaseBy(4);
//returns 9
//returns 10

Join the Newsletter

My newsletter is where you'll find exclusive content from me. I write about technology, startups, and why you shouldn't call yourself a junior engineer

Web Mentions