Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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"));
 
PREVIOUS NEXT
Tagged: #company #assigns #customer #membership #id
ADD COMMENT
Topic
Name
1+4 =