Skip to content

Instantly share code, notes, and snippets.

@marsrvr
Created March 19, 2019 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marsrvr/59c8e4ba783c5970a38b897e991d1f2e to your computer and use it in GitHub Desktop.
Save marsrvr/59c8e4ba783c5970a38b897e991d1f2e to your computer and use it in GitHub Desktop.
Ivan on Tech Academy Smart Contract Programming course, Eloquent JavaScript Chapter 2, Exercise 2: "fizz buzz"
function fizzbuz(target) {
for (var i = 1; i <= target; i++) {
linestr = i;
if (i%3 == 0) {
linestr = 'fizz';
if (i%5 == 0){
linestr = 'fizzbuzz';
}
} else if (i%5 == 0) {
linestr = 'buzz';
}
console.log(linestr)
}
return 'done.'
}
@marsrvr
Copy link
Author

marsrvr commented Mar 19, 2019

Print number. "fizz" if divisible by 3. "buzz" if divisible by 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment