You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// maxOrMin solutionfunctionmaxOrMin(num1,num2,max){//sort the numbersvarsorted=[num1,num2].sort(function(a,b){returna-b;});if(max){//if max is true return the greater numberreturnsorted[1];}else{//otherwise return the lesser numberreturnsorted[0];}}
// use the isPrime function from the previous problem, defined again herevarisPrime=function(num){if(num<2){returnfalse;}for(vari=2;i<num;i+=1){if(num%i===0){returnfalse;}}returntrue;};varprimes=function(max){for(vari=2;i<=max;i+=1){if(isPrime(i)===true){console.log(i);}}};primes(100);