Skip to content

Instantly share code, notes, and snippets.

@nicokosi
Created April 11, 2020 12:40
Show Gist options
  • Save nicokosi/ebf6a3ba15d6f5b422435b78c93cf117 to your computer and use it in GitHub Desktop.
Save nicokosi/ebf6a3ba15d6f5b422435b78c93cf117 to your computer and use it in GitHub Desktop.
'use strict';
module.exports = {
answer
};
function answer(number) {
if (number % 15 === 0) {
return "FizzBuzz";
}
if (number % 5 === 0) {
return "Buzz";
}
if (number % 3 === 0) {
return "Fizz";
}
return number;
}
'use strict';
const hiker = require('./hiker.js');
const assert = require('assert');
assert.equal(hiker.answer(1), 1);
assert.equal(hiker.answer(3), "Fizz");
assert.equal(hiker.answer(5), "Buzz");
assert.equal(hiker.answer(15), "FizzBuzz");
// - - - - - - - - - - - - - - - - - - - - - -
const greenTrafficLightPattern = function() {
return 'All tests passed';
};
console.log(greenTrafficLightPattern());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment