|
| 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 | + |
0 commit comments