Created
August 23, 2017 01:43
-
-
Save claudiainbytes/642e06438a7936b43b3b433812ff23c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* | |
| * Programming Quiz: Build A Triangle (5-3) | |
| */ | |
| // creates a line of * for a given length | |
| function makeLine(length) { | |
| var line = ""; | |
| for (var j = 1; j <= length; j++) { | |
| line += "* "; | |
| } | |
| return line + "\n"; | |
| } | |
| // your code goes here. Make sure you call makeLine() in your own code. | |
| function buildTriangle(num){ | |
| let output = ""; | |
| for (let x = 1; x <= num; x++ ) { | |
| output += makeLine(x); | |
| } | |
| return output; | |
| } | |
| console.log(buildTriangle(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment