Niech mi ktoś wytłumaczy czemu to nie działa błagam.
player.score przypisywane jest po zakonczeniu gry i np wynosi ono 3 a i tak pętla nie działa
const saveList = () => {
rankingNick.forEach((player) => {
console.log(player.score)
for (let i = 100; player.score === i; i--) {
console.log(player.score)
if (player.lvl === 'easy') {
rankingEasy.push(player.nickplayer + ': ' + player.score)
} else if (player.lvl === 'medium') {
rankingMedium.push(player.nickplayer + ': ' + player.score);
} else if (player.lvl === 'hard') {
rankingHard.push(player.nickplayer + ': ' + player.score);
}
}
})
}