Превратите массив объектов избирателей в число людей, проголосовавших. Помогите мне, я начинаю изучать javascript, но я так запутался с Reduce и Filter, который можно исправить? Я запускаю код и неопределенный @@ ``
function total(arr) {
let result = arr.filter(function(votes){
return votes !==true;
}).reduce(function(item,cur){
return [(+item),+(+cur)];
},[0]);}
var voters = [
{name:'Bob' , age: 30, voted: true},
{name:'Jake' , age: 32, voted: true},
{name:'Kate' , age: 25, voted: false},
{name:'Sam' , age: 20, voted: false},
{name:'Phil' , age: 21, voted: true},
{name:'Ed' , age:55, voted:true},
{name:'Tami' , age: 54, voted:true},
{name:'Mary', age: 31, voted: false},
{name:'Becky', age: 43, voted: false},
{name:'Joey', age: 41, voted: true},
{name:'Jeff', age: 30, voted: true},
{name:'Zack', age: 19, voted: false}
];``