From fa911bbdb831b6f83a510f8b8b5e4e474cd781fa Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Thu, 31 Mar 2022 09:34:04 -0500 Subject: [PATCH 1/2] first commit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bd1672b..e4cd426 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,4 @@ A basic console app built with Javascript `npm run start` +"# worksample-javascript" From 56b9c115c39a8bae9798830c1f9a92c35411c67a Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Thu, 31 Mar 2022 09:34:42 -0500 Subject: [PATCH 2/2] update --- package-lock.json | 21 +-------------------- src/index.js | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7559a08..ccc0324 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,27 +1,8 @@ { "name": "multivaluedictionary", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "multivaluedictionary", - "version": "1.0.0", - "license": "UNLICENSED", - "dependencies": { - "readline-sync": "^1.4.10" - } - }, - "node_modules/readline-sync": { - "version": "1.4.10", - "resolved": "https://proget.spreetail.org/npm/spreepm/readline-sync/-/readline-sync-1.4.10.tgz", - "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==", - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - } - }, "dependencies": { "readline-sync": { "version": "1.4.10", diff --git a/src/index.js b/src/index.js index aec8e4d..a8d5b56 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,44 @@ const { question } = require('readline-sync'); - +var dict = {'boom':'bass', 'shim':'sham', 'boom':'shakalaka'} async function run() { while(true) { const input = question('>'); console.log(`You input ${input}`); + if (input == 'ADD') { + let k = question('Enter key:') + console.log(`You input ${k}`); + let v = question('Enter value:') + console.log(`You input ${v}`); + dict[key] = value + console.log('Added'); + + } + if (input == 'MEMBERS') { + + let k = question('Enter key:') + console.log(`You input ${k}`); + for(let k in dict) { + console.log("k: ", k) + console.log("key: ", k) + let value = dict[k] + console.log("inside", value) + // if(k == key) { + // } + // i = 0; i < p.length; i++ + // console.log(key) + // console.log("value:", value) + } + // for(var i = 0; i < dict.length; i++) { + // var value = dict[i] + // console.log('value: ', value) + // console.log('k: ', k) + // if(value == k) { + + // console.log(`${i}) ${value}`) + // } + + // } + } } }