Skip to content

Instantly share code, notes, and snippets.

@abdulhalim-cu
Last active October 25, 2017 08:19
Show Gist options
  • Save abdulhalim-cu/dfd09cd82959e2b23de2b9e5236f631d to your computer and use it in GitHub Desktop.
Save abdulhalim-cu/dfd09cd82959e2b23de2b9e5236f631d to your computer and use it in GitHub Desktop.
Mountain view using javascript
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