Node.js examples for Number:Algorithm
Fizz buzz question
Number.prototype.hasMult = function( n ) { return Number.isInteger( this / n ) } function fun100() { out = []/*ww w . j a v a2 s.c o m*/ for ( var i = 1; i <= 100; i++ ) { if ( i.hasMult(3) ) { out.push['Fizz'] } else if ( i.hasMult(5) ) { out.push['Buzz'] } else if ( i.hasMult(5) && i.hasMolt(3) ) { out.push["Fizzbuzz"] } else { out.push( i.toString() ) } } return out }