March 30th, 2024
What's missing in this code?
function isSumOfDigitsPerfectSquare(num) {
return (
num
.toString()
('')
.reduce((a, b) =>
, 0) %
(num) ===
0
);
}
console.log(isSumOfDigitsPerfectSquare('5789875'));
// true (sum of digits is 49)
console.log(isSumOfDigitsPerfectSquare('123456'));
// false (sum of digits is 21)
Type or select from these options