5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Higher Order Functions lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Add 20 percent to each price and join the results with commas.
Keep only numbers above 4 and join them with commas.
Add 1, 2, 3 and 4 together using reduce.
Write a function that builds a multiplier, then triple 15.
Keep the even numbers from 1 to 6, multiply each by 10, and add them up.
forEach returns nothing, so there is no new array.
The callback has braces but no return, so nothing is kept.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceWithout a starting value the first item is used as the total.
The outer function returns a number, not a function.
Multiplying before filtering changes which numbers are kept.