Example 1 — Grow a row with fromCharCode
Restart at "A".charCodeAt(0) on every row, then add the column.
const start = "A".charCodeAt(0);
for (let row = 1; row <= 5; row++) {
let line = "";
for (let col = 0; col < row; col++) {
line += String.fromCharCode(start + col);
}
console.log(line);
} How It Works
- The outer
forsets how many letters this row prints. start + colis a number;fromCharCodeturns it into a letter.console.log(line)writes the finished string and ends the row.

