Created
November 15, 2017 22:30
-
-
Save Elli-P/1fcc397baa9031b2bfbbeeefd1ddb95b to your computer and use it in GitHub Desktop.
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 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