'how do I display stars in multiple lines
here is a small script in python.
for i in range(x):
print("*"*x)
in fact for x=2 for example it displays on line 1 2 stars and 2 stars on line 2. how to write in javascript? here is what I programmed (but it only displays 2 stars on line 1 for x=2)
for (let i = 0; i < x; i++) {
console.log('*' * x);
}
who can help me please?
Solution 1:[1]
for (let i = 0; i < x; i++){
console.log('*'.repeat(i));
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kacha Tschalataschvili |
