๐ŸŒˆ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค:Javascript] ๋ฌธ์ž์—ด ๋ฐ˜๋ณตํ•ด์„œ ์ถœ๋ ฅํ•˜๊ธฐ

Eun_zii 2024. 4. 11. 16:23

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค Lv.0

- ๋ฌธ์ž์—ด ๋ฐ˜๋ณตํ•ด์„œ ์ถœ๋ ฅํ•˜๊ธฐ

 

๐Ÿ’š ๋ฌธ์ œ์„ค๋ช…

 

๐Ÿ’š ์ œํ•œ์กฐ๊ฑด

  • 1 ≤ str์˜ ๊ธธ์ด ≤ 10
  • 1 ≤ n ≤ 5

๐Ÿ’š ํ’€์ด

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let input = [];

rl.on('line', function (line) {
    input = line.split(' ');
}).on('close', function () {
    str = input[0];
    n = Number(input[1]);
    console.log(str.repeat(n))
});

 

โœ… 

repeat( )๋ฉ”์„œ๋“œ๋กœ str์„ n๋ฒˆ๋งŒํผ ๋ฐ˜๋ณตํ•ด์ค€๋‹ค.

 

๐Ÿ’ก repeat() ๋ฉ”์„œ๋“œ๋Š” ๋ฌธ์ž์—ด์„ ์ฃผ์–ด์ง„ ํšŸ์ˆ˜๋งŒํผ ๋ฐ˜๋ณตํ•ด ๋ถ™์ธ ์ƒˆ๋กœ์šด ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

728x90