Commit d3d65d9e authored by natiphong  jung-in's avatar natiphong jung-in

week3

parent 53f14b3b
{
"name": "week03",
"version": "1.0.0",
"lockfileVersion": 1
}
{
"name": "week03",
"version": "1.0.0",
"description": "การบ้านสัปดาห์ที่สาม",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://projectcs.sci.ubu.ac.th/natiphong/nodejs-60-2.git"
},
"author": "",
"license": "ISC"
}
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let i = 0
let label = ['สวัสดี','อายุ','เบอร์โทร']
let data = []
rl.on('line',(line) => {
data[i] = line
i++
if (i == 3){
data[1] = 2561-(parseInt(data[1]))
console.log(label[0]+": "+data[0]+": "+label[1]+": "+data[1]+": "+label[2]+": "+data[2])
rl.close()
}
});
rl.on('close',() => rl.close())
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