Kuadrat setiap digit javascript
function squareDigits(num){
let string = num.toString(); // turn number to a string
let results = []; // create an array to save the new values of the string
for (let i = 0; i < string.length; i++){ // iterate through the string
results[i] = string[i] * string[i]; // save the square of the number to the array
}
return Number(results.join('')); // turn the array into a string and then into a number
}
Important Ibis