July 28th, 2024
What's missing in this code?
function oddishOrEvenish(num)
return num
.
()
.
('')
.reduce((sum, str) => sum +
(str), 0) %
===
0
? 'evenish'
: 'oddish';
}
oddishOrEvenish(13); // 4 -> evenish
oddishOrEvenish(473); // 14 -> evenish
oddishOrEvenish(3921); // 15 -> oddish
Type or select from these options