Answers for "your company assigns each customer a membership id"

2

your company assigns each customer a membership id

//your company assigns each customer a membership id
function createCheckDigit(membershipId) {
  let arr = membershipId.split('');
  while (arr.length > 1) {
    arr = arr.reduce((count, item) => {
      return count + parseInt(item);
    },0);
    arr = arr.toString().split('');
  }
  return arr[0];
}
 
console.log(createCheckDigit("55555"));
Posted by: Guest on September-30-2020

Code answers related to "your company assigns each customer a membership id"

Code answers related to "Javascript"

Browse Popular Code Answers by Language