I'm struggling to see how this could be related to Angular ...

On Thursday, January 21, 2016 at 4:03:33 AM UTC+1, Rohit Gayattri wrote:
>
> Hi,
>
>  I have been generating prime numbers in JavaScript i want to return true 
> if it's a prime or false if it'not below is the code i am struggling with 
> it. If a number is not a prime it should return  false but it's not.
>
> function isPrime(number){     
>       d = number-1;
>       while (d > 1){
>         if ((number % d) == 0) return false;
>         d--;
>       }
>       return true;       
>       
>     }    
>     
>     if (isPrime(19)){
>       alert('Prime');
>     }
>     else{
>       alert('Not Prime');
>     }
>     
>     //return 'false';
>
> var val = isPrime();
> document.getElementById('output').innerHTML = val;
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to