Commit 70d91fbf authored by rattanaporn  saysee's avatar rattanaporn saysee

การบ้านสัปดาห์ที่ 3

parent 5c427b88
const rl = require('readline')
const r = rl.createInterface({
input: process.stdin,
output: process.stdout
});
let i = 0
// let label = ['name','year','phone']
// let data =[]
r.on('line',(line) =>{
if(i==0){
name = line
i++
}else if (i==1){
year = 2561-line
i++
}else if (i==2){
console.log(`สวัสดีคุณ : ${name} อายุ :${year} เบอร์โทรศัพท์ :${line}`);
r.close();
}
})
//
// // data[label[i]] = line
// console.log(`${label[i]} == ${line}`)
// i++
// if (i==3){
// // console.log('label', lelel)
// // label[9]= 'Holy Cow!'
// // console.log('label',label)
// console.log('data ',data )
// r.close()
// }
// })
//
// let i = 1
// r.on('line',(line) => {
// console.log(`line == ${line} and i = ${i}`)
// i++
// if (i==3){
//
// r.close()
// }})
//
//
// r.on('close',() => 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": "5811403750",
"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