index.js 644 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
const readline = require('readline');
// const fs = require('fs');

// const io = readline.createInterface({
//     input: fs.createReadStream('package.json'),
//     crlfDelay: Infinity
// });

// io.on('line', (line) => {
//     console.log('data in line : ' + line);

// });

// io.close('close', () => {
//     console.log('จบการรับค่า');
// });

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

io.question('> ', (answer) => {
    console.log(`สวัสดีคุณ ${answer}`);
    io.close();
});

// console.info("hello word");
// console.log(`name = ${name}`);