1 parent 872b420 commit 6601711Copy full SHA for 6601711
1 file changed
JavaScript/Day8 Dictionaries and Maps.js
@@ -0,0 +1,17 @@
1
+function processData(input) {
2
+ input = input.split('\n');
3
+ var phoneBook = [];
4
+
5
+ for(i=1;i<=parseInt(input[0]);i++) {
6
+ var contactArray =input[i].split(' ');
7
+ phoneBook[contactArray[0]] = contactArray[1];
8
+ }
9
10
+ for(i=(parseInt(input[0])+1);i<input.length;i++){
11
+ if(phoneBook[input[i]]) {
12
+ console.log(input[i] + '=' + phoneBook[input[i]]);
13
+ }else{
14
+ console.log('Not found');
15
16
17
+}
0 commit comments