I run the code multiple times but couldn't find the problem!!
A Narcissistic Number is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10).
Your code must return true or false (not 'true' and 'false') depending upon whether the given number is a Narcissistic number in base 10.
function narcissistic(value) {
let strDigits = value.toString();
let power = strDigits.length;
let arrayDigits = strDigits.split('');
let sum, poweredValue = 0;
for (let i = 0; i < power; i++){
poweredValue = Number(arrayDigits[i])**power;
sum += poweredValue;
}
if (sum === value){
return true;
}else {
return false;
}
};