Created
February 9, 2015 21:53
-
-
Save bnb/f813c6bc58d4fb314c65 to your computer and use it in GitHub Desktop.
First JavaScript Program!
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
| function landscape() { | |
| var toLog = ''; | |
| var flat = function(num) { | |
| for(var i = 0; i < num; i++) { | |
| toLog += '_'; | |
| } | |
| } | |
| var mountain = function(num) { | |
| var start = '/'; | |
| var end = '\\'; | |
| var top = '\''; | |
| toLog += start; | |
| for(var i = 0; i < num; i++ ) { | |
| toLog += top; | |
| } | |
| toLog += end; | |
| } | |
| flat(3); | |
| mountain(2); | |
| flat(2); | |
| mountain(3); | |
| mountain(4); | |
| mountain(6); | |
| flat(1); | |
| mountain(3); | |
| mountain(1); | |
| flat(4); | |
| mountain(2); | |
| flat(6); | |
| return toLog; | |
| } | |
| console.log(landscape()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment