Number to String fizz buzz - Node.js Number

Node.js examples for Number:Algorithm

Description

Number to String fizz buzz

Demo Code


Number.prototype.toString = function(){
  var fizzBuzz = '';

  if(this%3 == 0){
    fizzBuzz = "Fizz";
  }//from  w  w  w  .ja  va  2  s .c om

  if(this%5 == 0) {
    fizzBuzz += "Buzz";
  }

  return fizzBuzz || this + '';
}

Related Tutorials