Advertisement
Spocoman

02. Number Modification

Jan 30th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (number) {
  2.     let arr = number.toString().split('');
  3.  
  4.     while (arr.map(Number).reduce((a,b) => a + b, 0) / arr.length <= 5) {
  5.         arr.push('9');
  6.     }
  7.     console.log(arr.join(''));
  8. }
  9.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement