October 10th, 2024
What's missing in this code?
drawTriangle(3);
// *****
// ***
// *
drawTriangle(5);
// *********
// *******
// *****
// ***
// *
function drawTriangle(height) {
for (let i = height; i
0;
) {
let spaces = ' '.repeat(height - i);
let stars = '*'.repeat(
);
console.log(spaces + stars);
}
}
Type or select from these options