Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
FizzBuzz solution in Clear category for [old] Fizz Buzz by suhovss123
"use strict";
function fizzBuzz(data) {
var res = (data % 15 == 0) ? "Fizz Buzz":
data % 5 == 0 ? "Buzz":
data % 3 == 0 ? "Fizz":
"" + data;
return res;
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(fizzBuzz(15), "Fizz Buzz", "15 is divisible by 3 and 5");
assert.equal(fizzBuzz(6), "Fizz", "6 is divisible by 3");
assert.equal(fizzBuzz(5), "Buzz", "5 is divisible by 5");
assert.equal(fizzBuzz(7), "7", "7 is not divisible by 3 or 5");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
July 27, 2016
Comments: