Keep active accounts
Take your time, follow the code and check your understanding.
The codeAPI transformations
Example checks
INPUT
[
{
"id": 1,
"active": false
},
{
"id": 2,
"active": true
}
]EXPECTED[
{
"id": 2,
"active": true
}
]INPUT
[]EXPECTED
[]
Your answer5 min · no timer
Implement solve(rows) and return a value. The example checks are visible. JavaScript runs in an isolated, network-blocked worker with a 2-second limit.
Show solution and explanation
A boolean predicate can be used directly.
function solve(rows) {
return rows.filter(row => row.active);
}