Back
Close
Can you create a filter function with reduce only
// Filter takes an array and returns another array.
// Each item is run against a predicate. If the function returns true, the item is added to the new array.
// For example:
// [ 5, 10, 15, 20 ].filter(item => item > 10) => returns [ 15, 20 ]
// TODO: Create a filter function using only reduce
// I have a prices array, I only want the items with a price higher than 6.
// GOOD LUCK
const prices = [ 2.99, 5.99, 7.2, 15, 2000, 0.99 ] // should return [ 7.2, 15, 2000 ]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants