Last active
October 28, 2015 18:38
-
-
Save pablasso/ec8c3621be892adf166a to your computer and use it in GitHub Desktop.
CodeGDL Extra Exercises
This file contains hidden or 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 chessBoardString = ""; | |
| var rowNumber = 0; | |
| var size = 8; | |
| for (var i = 0; i < size; i++) { | |
| for (var j = 0; j < size; j++){ | |
| if ((j + rowNumber) % 2 == 0){ | |
| chessBoardString += "#"; | |
| } | |
| else { | |
| chessBoardString += " "; | |
| } | |
| } | |
| chessBoardString += "\n"; | |
| rowNumber++; | |
| } | |
| console.log(chessBoardString); |
This file contains hidden or 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 characters = 8 * 9; | |
| var string = ''; | |
| for (var i = 1; i <= characters; i++) { | |
| if (i % 9 === 0) { | |
| string = string + "\n"; | |
| } | |
| else { | |
| string = string + '#'; | |
| } | |
| } | |
| console.log(string); |
This file contains hidden or 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 (var i=1; i<=100; i++) { | |
| if (i % 3 === 0) { | |
| console.log('Fizz'); | |
| } | |
| else if (i % 5 === 0) { | |
| console.log('Buzz'); | |
| } | |
| else { | |
| console.log(i); | |
| } | |
| } |
This file contains hidden or 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 (var i=1; i<=100; i++) { | |
| if (i % 3 === 0 && i % 5 === 0) { | |
| console.log('FizzBuzz'); | |
| } | |
| else if (i % 3 === 0) { | |
| console.log('Fizz'); | |
| } | |
| else if (i % 5 === 0) { | |
| console.log('Buzz'); | |
| } | |
| else { | |
| console.log(i); | |
| } | |
| } |
This file contains hidden or 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 string = '#'; | |
| while (string.length < 7) { | |
| console.log(string); | |
| string = string + '#'; | |
| } |
This file contains hidden or 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 (var i=1; i<=10; i++) { | |
| if (i % 2 === 0) { | |
| console.log('Doe'); | |
| } | |
| else { | |
| console.log('John'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment