Last active
March 18, 2023 17:19
-
-
Save desinas/b5035e10897586b2c596607d52fb13e3 to your computer and use it in GitHub Desktop.
Build a triangle Quiz (5-3) of Udacity FEWD
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(height) { | |
| var starTriangle = ""; | |
| for (var k = 1; k <= height; k++) { | |
| starTriangle += makeLine(k); | |
| } | |
| return starTriangle; | |
| } | |
| // test your code by uncommenting the following line | |
| console.log(buildTriangle(10)); |
thanks for your help
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What Went Well
Feedback: Your answer passed all our tests! Awesome job!