forked from CoachJulian/2023TeamEdgeTerm0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshopping_list.js
66 lines (41 loc) · 1.63 KB
/
shopping_list.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/********************************************************************
*
* Team Edge Array Mini-project: THE SHOPPING LIST HELPER
*
* This project prompts users using readline_sync to prompt users
* to add (or remove) items from a shopping list. It starts empty
* and each time the program is run it asks you to either add or
* remove an item from the list. It also updates the user of its
* contents. The shopping list also checks to see if an item
* is already present in the array and prevents you from adding it
* again, giving feedback along the way.
*
* ***************************************************************/
const READLINE = require("readline-sync");
let active = true
console.log("Welcome to: ")
console.log(`
__.. . ,
(__ |_ _ ._ ._ *._ _ | * __-+-
.__)[ )(_)[_)[_)|[ )(_] |___|_) |
| | ._|
`)
let welcomeMessage = `Hi! I'm your shopping assistant. Let me take your order. \n
You can type 'add milk' to add milk to your shopping list. \n
or you can type 'remove milk' to remove it. \n`
console.log(welcomeMessage)
//-->Todo: declare a shoppingList array
while(active){
checkAnswer(promptUser()) //this makes the program continously prompt and check response while the boolean 'active' returns true
}
function promptUser(){
let reply = READLINE.question("What do you want to add or remove? >> ")
return reply
}
function checkAnswer(){
}
function addItem(){
//this function can take in a string and store it in an array
}
function removeItem(){
}