Skip to content

Instantly share code, notes, and snippets.

@kasperlewau
Created December 16, 2013 10:28
Show Gist options
  • Save kasperlewau/7985015 to your computer and use it in GitHub Desktop.
Save kasperlewau/7985015 to your computer and use it in GitHub Desktop.
randomz
function arr (i) { return i ? arr(i-1).concat(i) : [] }
_.each(arr(100), function (x) {
console.log((x % 3 === 0 ? 'Fizz' : '')+(x % 5 === 0 ? 'Buzz' : '') || x);
});
@kasperlewau
Copy link
Author

const src = [...new Array(100).keys()];

for (i of src) {
  const f = i % 3 == 0;
  const b = i % 5 == 0;
  const fb = f && b;

  console.log(fb ? 'fizzbuzz' : f ? 'fizz' : b ? 'buzz' : i)
}

@kasperlewau
Copy link
Author

for (i of src) {
  const f = i % 3 == 0; 
  const b = i % 5 == 0;
  
  console.log(f && b ? 'fizzbuzz' : f ? 'fizz' : b ? 'buzz' : i)
}

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