print triangle in node js code example
Example: print triangle in javascript
let n = 5; // you can take input from prompt or change the value
let string = "";
for (let i = 0; i < n; i++) {
// printing star
for (let k = 0; k < n - i; k++) {
string += "*";
}
string += "\n";
}
console.log(string);