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
winai buttasart
nodejs-60-2
Commits
238ca4dc
Commit
238ca4dc
authored
Jan 31, 2018
by
winai buttasart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
การบ้าน 3
parent
e0ddf37b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
index.js
week03/index.js
+40
-0
package.json
week03/package.json
+19
-0
No files found.
week03/index.js
0 → 100644
View file @
238ca4dc
const
readline
=
require
(
'readline'
);
let
dateNow
=
new
Date
().
getFullYear
()
+
543
;
let
name
,
year
,
tel
;
const
io
=
readline
.
createInterface
({
input
:
process
.
stdin
,
output
:
process
.
stdout
});
let
count
=
0
;
let
data
=
{};
console
.
log
(
'กรอกชื่อ : '
);
io
.
on
(
'line'
,
(
line
)
=>
{
switch
(
count
)
{
case
0
:
data
[
'name'
]
=
line
;
count
++
;
console
.
log
(
'กรอกปีเกิด(พ.ศ.) : '
);
break
;
case
1
:
data
[
'year'
]
=
line
;
count
++
;
console
.
log
(
'กรอกเบอร์โทร : '
);
break
;
case
2
:
data
[
'tel'
]
=
line
;
data
[
'old'
]
=
dateNow
-
data
.
year
;
io
.
close
();
console
.
log
();
// console.log(data);
console
.
log
(
'สวัสดีคุณ : '
+
data
.
name
);
console
.
log
(
'เบอร์โทร : '
+
data
.
tel
);
// console.log('ปีเกิด : ' + data.year);
console
.
log
(
'อายุ : '
+
data
.
old
+
' ปี'
);
break
;
}
});
io
.
on
(
'close'
,
()
=>
io
.
close
());
\ No newline at end of file
week03/package.json
0 → 100644
View file @
238ca4dc
{
"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://cs.sci.ubu.ac.th/b/Zt7yXa96XFPGXhvrg/node-js-60-2"
},
"keywords"
:
[
"homework"
,
"03"
],
"author"
:
"5811403796"
,
"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