728x90
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let input = [3];
rl.on('line', function (line) {
input = line.split(' ');
}).on('close', function () {
const star = Number(input[0]);
for (let i = 1; i <= star; i++) {
console.log('*'.repeat(i));
}
});
์ฒจ์ ์ฃผ์ด์ง ์ฝ๋ ๋ณด๊ณ ์ข ๋นํฉํ๋๋ฐ,
๋ค์์ ์ฐพ์๋ณธ ํ ๋ค์ ๋ณด๋ ์ด๋์ ๋ฌธ์ ๋ฅผ ํ๋ฉด ๋ ์ง ๋ณด์๋ค.
์ฐพ์ผ๋ฉด์ repeat ์ด๋ String ํจ์์ ๋ํด์๋ ์๊ฒ ๋๋ค.
str.repeat(count);
str : ์ด๋ค ๋ฌธ์๋ฅผ
repeat ๋ฐ๋ณตํ๋ค
count : ๋ช๋ฒ
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
728x90
๋ฐ์ํ