Left Triangle Star Pattern Program

Left Triangle Star Pattern Program

February 09, 2023


Learn How to make Left Triangle Star Pattern Program in JavaScript

today I'm going to teach you how to make Left Triangle Star Program using JavaScript.

  • We need to make two loops for this.
  • The first loop for how many rows we want and the second loop for how many columns we want.

Example

Add this Code in your JavaScript File

var x = 5; //number of rows
for (let i = 1; i <= x; i++) { // loop for rows
    for (let j = 1; j <= i; j++) { // loop for column
        document.write("*"); // printing * statement
    }
    document.write("<br/>"); // printing line break statement 
}
Try this code