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

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

Eun_zii 2024. 4. 11. 16:07

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

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

 

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

 

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

  • 1 ≤ str1, str2์˜ ๊ธธ์ด ≤ 10

๐Ÿ’š ํ’€์ด

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 () {
    str1 = input[0];
    str2 = input[1];
    console.log(input.join(""));
});

 

โœ… 

input = line.split(' ') : ์œผ๋กœ ๋ฐฐ์—ด์— ์ €์žฅ๋œ ๊ณต๋ฐฑ์œผ๋กœ ๋ถ„ํ• ๋˜์–ด์žˆ๋Š” ๋ฌธ์ž์—ด์„

str1 = input[0] : ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ž์—ด์„ ๋ณ€์ˆ˜์— ์ €์žฅํ•˜๊ณ ,

str2 = input[1] : ๋‘ ๋ฒˆ์งธ ๋ฌธ์ž์—ด์„ ๋ณ€์ˆ˜์— ์ €์žฅํ•ด์ค€๋‹ค.

๊ทธ๋ฆฌ๊ณ  console.log(input.join("")) : join( ) ๋ฉ”์„œ๋“œ๋กœ ๋‘ ๋ฌธ์ž์—ด์„ ์ด์–ด๋ถ™์—ฌ์„œ ์ถœ๋ ฅํ•ด์ค€๋‹ค.

 

728x90