FizzBuz

JavaScript performance comparison

Test case created and last updated

Info

better fizz

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Fizzbuz
function fizzBuzz(i) {
  var lb = (810092048 >> (((i - 1) << 1) % 30)) & 3;

  return lb ? [null, "Fizz", "Buzz", "FizzBuzz"][lb] : i;
}
pending…
Old
function fizzBuzz(number) {

  if (number % 3 !== 0) {
    if (number % 5 !== 0) {
      return number;
    }
    return 'buzz';
  }
  if (number % 5 !== 0) {
    return 'fizz';
  }

  return 'fizzbuzz';
};
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment