Skip to content

Instantly share code, notes, and snippets.

@ashleyvernon
Forked from anonymous/index.html
Created August 15, 2016 03:01
Show Gist options
  • Save ashleyvernon/9dabf4148b145307bc151906703a65ca to your computer and use it in GitHub Desktop.
Save ashleyvernon/9dabf4148b145307bc151906703a65ca to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/cixusi
<!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>
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