I have this number 55555
If we add this single number then the result will be = 25 and then if we add 2 + 5 then the result will be 7.
I want to make it but can't get the result:
What I have done so far:
function createCheckDigit(membershipId) {
// Write the code that goes here.
string = membershipId.split('');
let sum = 0;
for (var i = 0; i < string.length; i++) {
sum += parseInt(string[i],10);
}
console.log(sum.split(''));
}
console.log(createCheckDigit("55555"));
suma number, what wouldsum.spliteven do?