Commit 7dc7fc14 authored by nontawat kanboon's avatar nontawat kanboon

ส่งงานweek03

parent 0fad0cbc
const rl = require('readline');
const r = rl.createInterface(input = process.stdin)
/*
r.question('กรอกชื่อ ', (name) => {
r.question('ปีเกิด พ.ศ. ', (year) => {
year = 2561 - year
r.question('ขอเบอร์ด่วน ', (phone) => {
console.log(`คุณ ${name} อายุ ${year} เบอร์ ${phone}.`)
r.close()
})
})
});*/
let i = 0
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[1]} ปี เบอร์ ${data[2]}`)
r.close()
}
})
{
"name": "week03",
"version": "1.0.0",
"description": "การบ้านสัปดาห์ที่ 3",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"้homework",
"03"
],
"author": "5xxxxxx",
"license": "ISC"
}
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