JS
…
Dashboard/Intermediate JavaScript/higher-order functions

Module 2 of 4

higher-order functions

Callbacks, closures, and reusable function factories.

Intermediate JavaScript · 0/4 completed · scroll down for every challenge

Challenge 1 of 4

Apply twice

Instructions

Write `applyTwice(fn, value)` that calls `fn` two times on `value`.

Editor

IntelliSense on

// Write your code below

Challenge 2 of 4 · Make multiplier

Challenge 2 of 4

Make multiplier

Instructions

Write `makeMultiplier(x)` returning a function that multiplies by `x`.

Editor

IntelliSense on

// Write your code below

Challenge 3 of 4 · Count with closure

Challenge 3 of 4

Count with closure

Instructions

Write `makeCounter()` that returns a function incrementing a private count from 0.

Editor

IntelliSense on

// Write your code below

Challenge 4 of 4 · Compose two

Challenge 4 of 4

Compose two

Instructions

Write `compose(f, g)` that returns a function `x => f(g(x))`.

Editor

IntelliSense on

// Write your code below

Next module