Function that return number num if num is armstrong else return 0
function checkArmstrong ( x ) { let n = ( x . toString ( ) ) . length ; let sum1 = 0 ; let temp = x ; while ( temp > 0 ) { let digit = temp % 10 ; sum1 += Math . pow ( digit , n ) ; temp = parseInt ( temp / 10 , 10 ) ; } if ( sum1 == x ) return x ; return 0 ; }