Last active
December 20, 2017 08:21
-
-
Save desinas/b93c64c17405348609ff07d83a1117c7 to your computer and use it in GitHub Desktop.
Julia James Quiz (4-1) from Udacity Frond end developer
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
/* | |
* Programming Quiz: JuliaJames (4-1) | |
*/ | |
//version using an extra string for concatecate the result | |
var x = 1; | |
while (x < 21) { | |
fizzbuzz = ""; //string init in every loop cycle | |
if (x%3 === 0) fizzbuzz += "Julia"; //concat Julia if x mod 3 equals 0 | |
if (x%5 === 0) fizzbuzz += "James"; //concat James if x mod 5 equals 0 | |
if (!fizzbuzz) fizzbuzz +=x; //if none of the above checks then give x to the string | |
console.log(fizzbuzz); //output the string | |
x += 1; | |
} |
Revision 3 is a version using an extra string for concatenate the result and then output it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What Went Well
Feedback: Your answer passed all our tests! Awesome job!