문제: https://school.programmers.co.kr/learn/courses/30/lessons/181950
문자열 str
과 정수 n
이 주어집니다.
str
이 n
번 반복된 문자열을 만들어 출력하는 코드를 작성해 보세요.
str
의 길이 ≤ 10n
≤ 5입력 #1
string 5
출력 #1
stringstringstringstringstring
Node.js환경에서 사용되는 'readline'모듈을 활용한 문제
repeat 메소드 : string.repeat([반복 count])
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)) //이부분만 추가함
});