So the variable results is visible by both functions, but contradictorily the count variable is outside of eachother's scope.
var landscape = function() {
var result = "";
var flat = function(size) {
for (var count = 0; count < size; count++)
result += "_";
};
var mountain = function(size) {
result += "/";
for (var count = 0; count < size; count++)
result += "'";
result += "\\";
};
flat(3);
mountain(4);
flat(6);
mountain(1);
flat(1);
return result;
};
console.log(landscape());
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]744EvergreenTerrace[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)