Count completed tasks
Take your time, follow the code and check your understanding.
The codeAPI transformations
Example checks
INPUT
[
{
"completed": true
},
{
"completed": false
},
{
"completed": true
}
]EXPECTED2
INPUT
[]EXPECTED
0
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
Filter the completed records and read the resulting length.
function solve(rows) {
return rows.filter(row => row.completed).length;
}