Skip to content

Instantly share code, notes, and snippets.

@Elli-P
Created November 15, 2017 22:30
Show Gist options
  • Save Elli-P/1fcc397baa9031b2bfbbeeefd1ddb95b to your computer and use it in GitHub Desktop.
Save Elli-P/1fcc397baa9031b2bfbbeeefd1ddb95b to your computer and use it in GitHub Desktop.
var lines;
function buildTriangle(height){
var triangle = "";
var length = height;
for (var h = 1; h <= height; h++) {
lines = function makeLine(length) {
var line = "";
for (var j = 1; j <= length; j++) {
line += "* ";
}
return line + "\n";
}
triangle += line + "\n";
return triangle;
}
}
console.log(buildTriangle (10));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment