Commit 9e3eab27 authored by Natchaya Sripaksee's avatar Natchaya Sripaksee

ส่งการบ้านweek3

parent 738af216
......@@ -18,19 +18,17 @@
const rl = require('readline');
const r = rl.createInterface(input = process.stdin)
let i = 1
let label = ['name', 'year', 'phone']
r.on('line', (line) => {
let i = 0
data[label[i] = line
console.log(`line == ${line} and i=${i}`)
i++;
if (i == 3) {
console.log('label'.label)
console.log('data', data)
r.close();
}
})
r.on('close', () => r.close())
\ No newline at end of file
let data = []
r.on('line', (line) => {
data[i]= line
//console.log(${label[i]} == ${line} and i = ${i})
i++
if(i == 3) {
data[1] = 2561-data[1]
console.log(`สวัสดีคุณ ${data[0]} เบอร์ ${data[2]} คุณอายุ ${data[1]} ปี `)
r.close()
}
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment