프로그래머스 문자열 출력하기 Lv.0

KUKJIN LEE's profile picture

KUKJIN LEE2개월 전 작성

단순하게 rl.close(); 와 console.log(str)을 통해 출력하면 해결됩니다.

 

입력받고 종료를 해주면됩니다.

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

let input = [];

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

New Tech Posts