Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
nodejs-60-2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Supharoek Sudadet
nodejs-60-2
Commits
1cdb3b61
Commit
1cdb3b61
authored
Jan 31, 2018
by
Supharoek Sudadet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
การบ้านที่3
parent
add6e93a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
index.js
week03/index.js
+30
-0
package-lock.json
week03/package-lock.json
+5
-0
package.json
week03/package.json
+18
-0
No files found.
week03/index.js
0 → 100644
View file @
1cdb3b61
const
readline
=
require
(
'readline'
);
const
rl
=
readline
.
createInterface
({
input
:
process
.
stdin
,
output
:
process
.
stdout
});
/*
rl.question('ใส่ชื่อของคุณ :', (name) => { // TODO: ใส่ชื่อของคุณ
rl.question('ใส่ปีเกิดของคุณ :', (year) => { // TODO: ใส่วันเกิดของคุณ
year = 2561 - year
console.log(`สวัสดีคุณ : ${name} คุณอายุ : ${year}`);
rl.close();
});
});
*/
let
i
=
0
let
label
=
[
'สวัสดี'
,
'อายุ'
,
'เบอร์โทร'
]
let
data
=
[]
rl
.
on
(
'line'
,
(
line
)
=>
{
data
[
i
]
=
line
//console.log(`${label[i]} == ${line} and i = ${i}`)
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
()
)
week03/package-lock.json
0 → 100644
View file @
1cdb3b61
{
"name"
:
"week03"
,
"version"
:
"1.0.0"
,
"lockfileVersion"
:
1
}
week03/package.json
0 → 100644
View file @
1cdb3b61
{
"name"
:
"week03"
,
"version"
:
"1.0.0"
,
"description"
:
"การบ้่านสัปดาที่ 3"
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"repository"
:
{
"type"
:
"git"
,
"url"
:
"http://projectcs.sci.ubu.ac.th/professorj/nodejs-60-2.git"
},
"keywords"
:
[
"homework03"
],
"author"
:
"5811403839"
,
"license"
:
"ISC"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment