Commit f97baf02 authored by tanapoom's avatar tanapoom

week03

parent 0dbf6c76
const rl = require('readline');
const r = rl.createInterface(input=process.stdin);
let i = 0
let lable = ['name','year พ.ศ.','phone']
r.on('line',(line) =>{
if(i==0){
name = line;
console.log(`${lable[i]} == ${line} and i = ${i}`)
i++;
}else if(i==1){
year = line;
console.log(`${lable[i]} == ${line} and i = ${i}`)
i++;
}else if(i==2){
phone = line;
console.log(`${lable[i]} == ${line} and i = ${i}`)
i++;
}
if(i == 3){
year = 2561-year;
console.log(`คุณชื่อ${name}อายุ${year}เบอร์${phone}`)
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": "5711403250",
"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