By Yohanes


2020-09-16 06:02:47 8 Comments

let printTriangle = (num) => {
 for ( let i = 0; i < num; i++) {
  for (let j = 0; j <= i; j++) {
     num += '*';
  }
  num += "\n"
 }
}
console.log(printTriangle(5));

I have a simple question although i cannot manage to resolve this problem. Hope you can help, how i should fix my code to make output:

*
**
***
****
*****

Related Questions

Sponsored Content

Sponsored Content