I'm trying to pop numbers from the ranks
array and add them all up in a counter variable. When I use +=
, it doesn't add them up, it just sticks the numbers together and returns 10987
. I'm using the let playerCountArray
variable as a placeholder for the result. Any clues to what's wrong here?
const ranks = [2, 3, 4, 5, 6, 7, 8, 9, 10];
let playerCountArray = [];
playerCountArray += popArr(ranks)
let popArr = (arr) => {
return arr.pop()
}
Thanks!