Solución
solution.tsTypeScript
function isArmstrong(num: number): boolean {
// Tu solución aquí
const splitedStrNums = num.toString().split("")
const numbersToTheNthPower = splitedStrNums.map(num=> {
const parsedNum = parseInt(num);
return Math.pow(parsedNum,splitedStrNums.length)
})
const theNthPowerSum = numbersToTheNthPower.reduce((prevValue, currentValue)=> prevValue+ currentValue, 0)
return num === theNthPowerSum ;
}
// No modificar: necesario para evaluar el resultado.
export { isArmstrong };0respuestas