Program for Armstrong Numbers |
function armstrong ( n ) { let number = new String ( n ) n = number . length let output = 0 for ( let i of number ) output = output + parseInt ( i ) ** n if ( output == parseInt ( number ) ) return ( " " + " " ) else return ( " " + " " ) } document . write ( armstrong ( 153 ) ) document . write ( armstrong ( 120 ) )