Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. /*
  2. * Programming Quiz: Build A Triangle (5-3)
  3. */
  4.  
  5. // creates a line of * for a given length
  6. function makeLine(length) {
  7. var line = "";
  8. for (var j = 1; j <= length; j++) {
  9. line += "* ";
  10. }
  11. return line;
  12. }
  13.  
  14. // your code goes here. Make sure you call makeLine() in your own code.
  15. function buildTriangle(height){
  16. for ( var i = 0; i < height; i++){
  17. console.log(makeLine(i + 1));
  18. }
  19. }
  20.  
  21. // test your code by uncommenting the following line
  22. console.log(buildTriangle(10));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement