Skip to content

Commit c460cca

Browse files
authored
Initial Commit
1 parent d2925af commit c460cca

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

app.js

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
const employeeList = [
2+
{
3+
name: 'Jan',
4+
officeNum: 1,
5+
phoneNum: '222-222-2222'
6+
},
7+
{
8+
name: 'Juan',
9+
officeNum: 304,
10+
phoneNum: '489-789-8789'
11+
},
12+
{
13+
name: 'Margie',
14+
officeNum: 789,
15+
phoneNum: '789-789-7897'
16+
},
17+
{
18+
name: 'Sara',
19+
officeNum: 32,
20+
phoneNum: '222-789-4654'
21+
},
22+
{
23+
name: 'Tyrell',
24+
officeNum: 3,
25+
phoneNum: '566-621-0452'
26+
},
27+
{
28+
name: 'Tasha',
29+
officeNum: 213,
30+
phoneNum: '789-766-5675'
31+
},
32+
,
33+
{
34+
name: 'Ty',
35+
officeNum: 211,
36+
phoneNum: '789-766-7865'
37+
},
38+
{
39+
name: 'Sarah',
40+
officeNum: 345,
41+
phoneNum: '222-789-5231'
42+
}
43+
];
44+
45+
46+
47+
const employeeListMatt = {
48+
name: 'Matt',
49+
officeNum: 100,
50+
phoneNum: '222-222-2222'
51+
}
52+
53+
// Command Zone
54+
55+
const inputCommand = prompt('Enter Command');
56+
const commandList = ['print', 'verify', 'lookup', 'contians', 'update', 'add', 'delete'];
57+
let msg = '';
58+
let output = '';
59+
60+
for (let i = 0; i < commandList.length; i++) {
61+
render(commandList[i]);
62+
}
63+
64+
render('--------------------------')
65+
66+
67+
for (let i = 0; i < commandList.length; i++) {
68+
69+
if(inputCommand === commandList[0]){
70+
msg = 'I will Print';
71+
for (let j = 0; j < employeeList.length; j++) {
72+
render(employeeList[j].name);
73+
}
74+
}
75+
76+
else if(inputCommand === commandList[1]){
77+
msg = 'I will Verify';
78+
79+
const inputVerify = prompt('Enter Name');
80+
81+
for (let j = 0; j < employeeList.length; j++) {
82+
render(employeeList[j].name);
83+
84+
if(inputVerify === employeeList.name){
85+
render('True');
86+
}
87+
88+
}
89+
90+
}
91+
92+
else if(inputCommand === commandList[2]){
93+
msg = 'I will Lookup';
94+
const lookName = prompt('Lookup Name');
95+
}
96+
97+
else if(inputCommand === commandList[3]){
98+
msg = 'I will Contains?';
99+
}
100+
101+
else if(inputCommand === commandList[4]){
102+
msg = 'I will Update';
103+
}
104+
105+
else if(inputCommand === commandList[5]){
106+
msg = 'I will Add';
107+
}
108+
109+
else if(inputCommand === commandList[6]){
110+
msg = 'I will Delete';
111+
}
112+
}
113+
114+
115+
render(msg);
116+
render(output);
117+

index.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<div id="content"></div>
11+
<script src="render.js"></script>
12+
<script src="app.js"></script>
13+
</body>
14+
</html>
15+

render.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const render = (...props) => {
2+
props.forEach(e => {
3+
append(e);
4+
});
5+
}
6+
7+
const append = content => {
8+
const p = document.createElement('p');
9+
p.textContent = content;
10+
document.getElementById('content').appendChild(p);
11+
}

0 commit comments

Comments
 (0)