Example 1 — Shrink the row with the outer loop
Start row at 5 and stop at 1. The inner loop appends 1 through row.
const rows = 5;
for (let row = rows; row >= 1; row--) {
let line = "";
for (let n = 1; n <= row; n++)
line += n;
console.log(line);
} How It Works
row--makes each later line one digit shorter.- The inner
foralways restarts at 1, so every row begins with 1. line += nbuilds the string;console.logends the row.

