Last active
October 25, 2017 08:19
-
-
Save abdulhalim-cu/dfd09cd82959e2b23de2b9e5236f631d to your computer and use it in GitHub Desktop.
Mountain view using javascript
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
var landscape = function() { | |
var result = ""; | |
var flat = function(size){ | |
for (i=0; i<size; i++) | |
result += "_"; | |
} | |
var mountain = function(size){ | |
result += "/" | |
for (i=0; i<size; i++) | |
result += "'"; | |
result += "\\"; | |
} | |
flat(5); | |
mountain(3); | |
flat(6); | |
mountain(2); | |
flat(2); | |
return result; | |
} | |
console.log(landscape()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment