function checkArmstrong(num) {
const digits = num.toString().split('')
let sum = 0
digits.forEach(value => {
sum += value ** digits.length
})
return sum === num
}
console.log(checkArmstrong(153))
Created 2019-11-24T04:53:20+05:30 · Edit