The challenge is to keep on adding up all the digits of a number until it is a single digit. For the solution there is plus signs before the variables, which I have never seen before. Also if you remove it, it will return an error.
function additivePersistence(n) {
let count=0;
while(String(n).length>1){
n=[...String(n)].reduce((a, b)=>+a + +b);
count++;
}
return count;
}
Can someone explain to me what that is doing"