Question: Download the ZIP file below containing HTML and JavaScript files. Complete the drawTriangle ( ) function in script.js that draws a triangle with asterisks (
Download the ZIP file below containing HTML and JavaScript files. Complete the drawTriangle function in script.js that draws a triangle with asterisks based on the triangleSize parameter.
Ex: drawTriangle outputs to the console a triangle with triangleSize so the longest side asterisks appears on the bottom line:
Hint: Use a loop inside a loop to complete drawTriangle The outer loop is responsible for outputting each 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.function drawTriangletrianglesize
for let ; size;
let line ;
for let ; j i; j
line ;
console. line;
drawTriangle;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
