Last active
November 13, 2018 15:11
-
-
Save youngjinmo/759d1b01b54a330c1a7ee3cb6468d312 to your computer and use it in GitHub Desktop.
Passed second answer that quiz 5-3 in Intro to JavaScript at Udacity.
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
/* | |
* 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(width){ | |
var triangle = ""; | |
for(var i=1; i<=width; i++){ | |
triangle += makeLine(i); | |
} | |
return triangle; | |
} | |
// test your code by uncommenting the following line | |
console.log(buildTriangle(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feedback
What Went Well
Feedback
Your answer passed all our tests! Awesome job!