Last active
August 29, 2015 14:05
-
-
Save capitalJT/47d9b351ddc54f7d03d9 to your computer and use it in GitHub Desktop.
[if else statements using the modulo operator]// source http://jsbin.com/biqif/3
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
for(i = 100; i; i--){ | |
if(i % 3 === 0){ | |
console.log("fizz " + i); | |
} else if(i % 5 === 0){ | |
console.log("buzz " + i); | |
} | |
if(i % 3 === 0 && i % 5 === 0){ | |
console.log("buzzbuzz " + i); | |
} | |
} |
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 name="description" content="[if else statements using the modulo operator]" /> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
This is just a comment | |
<script id="jsbin-javascript"> | |
for(i = 100; i; i--){ | |
if(i % 3 === 0){ | |
console.log("fizz " + i); | |
} else if(i % 5 === 0){ | |
console.log("buzz " + i); | |
} | |
if(i % 3 === 0 && i % 5 === 0){ | |
console.log("buzzbuzz " + i); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment