drawTriangle

Complete the drawTriangle() function in script.js that draws a triangle with asterisks (*) based on the size parameter.Ex: drawTriangle(4) outputs to the console a triangle with size 4, so the longest side (4 asterisks) appears on the bot***** *****ne:*
**
***
****
Hint: Use a loop inside a loop to complete drawTriangle(). The outer loop is responsible for outputting the asterisk line, and the inner loop is responsible for building the asterisk line with the appropriate length by concatenating asterisks to a single string.To test the JavaScript in your web browser, call drawTriangle() from the JavaScript console.

×
New Download