ส่งงานสัปดาห์ที่3

parent 46ba41b6
const readline = require('readline')
const r = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let i = 0
console.info("คุณชื่ออะไร: ");
r.on('line',(line) =>{
if(i==0){
console.info("เบอร์โทร:์ ");
name = line
i++
}else if (i==1){
console.info("ปีเกิด: ");
phone = line
i++
}else if (i==2){
console.log(`สวัสดีคุณ ${name} เบอร์ ${phone} อายุ ${2561 -line}`);
r.close();
}
})
{
"name": "week03",
"version": "1.0.0",
"description": "clone",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"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