Skip to content

Instantly share code, notes, and snippets.

@smockle
Created September 15, 2015 05:15
Show Gist options
  • Save smockle/310416f731e917cfd8bf to your computer and use it in GitHub Desktop.
Save smockle/310416f731e917cfd8bf to your computer and use it in GitHub Desktop.
FizzBuzz, in JavaScript
let array = [];
for (let i = 1; i <= 100; i++) {
let x = '';
if (i % 3 === 0) { x += 'Fizz'; }
if (i % 5 === 0) { x += 'Buzz'; }
if (x.length === 0) { x = i; }
array.push(x)
}
console.log(array.join('\n'));
@smockle
Copy link
Author

smockle commented Sep 15, 2015

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