Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 441 Bytes

File metadata and controls

16 lines (12 loc) · 441 Bytes
Welcome. In this kata, you are asked to square every digit of a number and concatenate them.

For example, if we run 9119 through the function, 811181 will come out, because 92 is 81 and 12 is 1.

Note: The function accepts an integer and returns an integer
function squareDigits(num){
  let numLetter = num.toString();
  let suqreNumber = numLetter.split('').map((digit) => digit ** 2);
  return +suqreNumber.join('')
}