Created
August 15, 2016 03:01
-
-
Save anonymous/0d8fa65ea483a8f5bf546d794a3e8c2f to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/cixusi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var fizzBuzz = function(num){ | |
for (var i = 1; i <= num; i += 1){ | |
if(num%3 === 0 && num%5 === 0){ | |
result "fizzbuzz"; | |
} else if(num%3 === 0){ | |
result "fizz"; | |
} else if(num%5 === 0){ | |
result "buzz"; | |
} else { | |
result = x | |
} | |
console.log(result); | |
} | |
}; | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var fizzBuzz = function(num){ | |
for (var i = 1; i <= num; i += 1){ | |
if(num%3 === 0 && num%5 === 0){ | |
result "fizzbuzz"; | |
} else if(num%3 === 0){ | |
result "fizz"; | |
} else if(num%5 === 0){ | |
result "buzz"; | |
} else { | |
result = x | |
} | |
console.log(result); | |
} | |
};</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fizzBuzz = function(num){ | |
for (var i = 1; i <= num; i += 1){ | |
if(num%3 === 0 && num%5 === 0){ | |
result "fizzbuzz"; | |
} else if(num%3 === 0){ | |
result "fizz"; | |
} else if(num%5 === 0){ | |
result "buzz"; | |
} else { | |
result = x | |
} | |
console.log(result); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment