I want to count the wins and losses out of an array of matches but for some reason it doesn't work. In theory it should work but both output 0.
Here is my code I'm using handlebars so the {{ work!
const matches = [{
id: '9',
primary_player: 'player1',
secondary_player: 'player2',
size: '5',
result: '0'
}]
const losses = matches.filter(e => e.result == "0" && e.primary_player == "player1").length;
const wins = matches.filter(e => e.result == "1" && e.primary_player == "player1").length;
console.log(losses,wins)