Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A programming challenge, popularized by Jeff Atwood, that prints the numbers from 1 to 100, where multiples of three print "Fizz," multiples of five print "Buzz," and multiples of both three and five print "FizzBuzz."
6
votes
3
answers
2k
views
Functional, recursive FizzBuzz in JavaScript
I was talking to a coworker about over engineering things, which somehow lead to me over engineering the hell out of fizzbuzz. I went for a functional recursive solution in JavaScript. … fizzbuzz();
function fizzbuzz() {
var i = 1;
var result = [];
(function loop() {
var str = '';
str += fizz(i);
str += buzz(i);
result.push(ifFalsy(str, i) …
7
votes
1
answer
754
views
Wrapping JS file in function, and assigning that function to a variable
function $(id) {
return document.getElementById(id);
}
// "public" functions
return {
fizzbuzz: function() {
var newhtml = '';
var output = 0; … for (var i = 1; i <= 100; i++) {
if (i % 3 == 0 && i % 5 == 0) {
output = "FizzBuzz";
} else if (i % 3 == 0) {
output = "Fizz"; …