Skip to content

Instantly share code, notes, and snippets.

@Philocoder93
Created December 17, 2016 14:50
Show Gist options
  • Select an option

  • Save Philocoder93/8454f9e1b6534cdf93906cf165be8319 to your computer and use it in GitHub Desktop.

Select an option

Save Philocoder93/8454f9e1b6534cdf93906cf165be8319 to your computer and use it in GitHub Desktop.
var fizzBuzz = function(a) {
for (i = 1; i <= a; i++) {
if (fizz(i)&&buzz(i)) {
console.log("fizzBuzz");
}
else if (fizz(i)) {
console.log("fizz");
}
else if (buzz(i)) {
console.log("buzz");
}
else {
console.log(i);
}
}
};
var fizz = function(a) {
if ((a % 3) === 0) {
return true;
}
else {
return false;
}
};
var buzz = function(a) {
if ((a % 5) === 0) {
return true;
}
else {
return false;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment