pattern
// Define the number of rows in the pattern
const numRows = 6;
// Create an empty string to store the pattern
let pattern = '';
// Loop through each row
for (let i = 0; i < numRows; i++) {
// Add spaces before the asterisks
for (let j = 0; j < numRows - i - 1; j++) {
pattern += ' ';
}
// Add asterisks
for (let k = 0; k <= i; k++) {
pattern += '*';
}
// Add a new line after each row
pattern += '\n';
}
// Print the pattern
console.log(pattern);