Skip to content

Instantly share code, notes, and snippets.

@claudiainbytes
Created August 23, 2017 01:43
Show Gist options
  • Select an option

  • Save claudiainbytes/642e06438a7936b43b3b433812ff23c2 to your computer and use it in GitHub Desktop.

Select an option

Save claudiainbytes/642e06438a7936b43b3b433812ff23c2 to your computer and use it in GitHub Desktop.
/*
* 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