13. Write a JavaScript function that check number is Armstrong or not?

A number is said to be Armstrong when its value is equal to its sum of cube of digits.

Example:

    Input:
    Number: 153

    Output:
    It is a prime number

    Explanation:
153 = (1*1*1) + (5*5*5) + (3*3*3) = 1+125+27 = 153
    Here, number (153) is equal to its sum of the digits cube (153).
  

        function armstrong(number)
        {
        var flag,remainder,addition = 0;
        var temp=number

        flag = number;
        while(number > 0)
        {
        remainder = number%10;
        addition = addition + remainder*remainder*remainder;
        number = parseInt(number/10);
        }

        if(addition == flag)
        {
        console.log( temp+" number is Armstrong");
        }
        else
        {
        console.log(temp+" number is not Armstrong");
        }
        }

        armstrong(153);
        armstrong(155);