Last updated 4 years ago
Was this helpful?
convert as string
split process-1 string as an array
iterate process-2
After parsing in the form of a number, apply the power of 2
join process-3 as a string
parse to number process-4
const squareDigits = (num) => Number( [...String(num)] .map((v) => Number(v) ** 2) .join('') );