Skip to content

Commit 61803e3

Browse files
committed
initializing
1 parent 8b9270a commit 61803e3

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

loops/studio/solution.js

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,67 @@
1-
const input = require('readline-sync');
1+
const input = require("readline-sync");
22

33
// Part A: #1 Populate these arrays
44

5-
let protein = [];
6-
let grains = [];
7-
let veggies = [];
8-
let beverages = [];
9-
let desserts = [];
10-
5+
let protein = ["chicken", "pork", "tofu", "beef", "fish", "beans"];
6+
let grains = ["rice", "pasta", "corn", "potato", "quinoa", "crackers"];
7+
let veggies = [
8+
"peas",
9+
"green beans",
10+
"kale",
11+
"edamame",
12+
"broccoli",
13+
"asparagus",
14+
];
15+
let beverages = ["juice", "milk", "water", "soy milk", "soda", "tea"];
16+
let desserts = [
17+
"apple",
18+
"banana",
19+
"more kale",
20+
"ice cream",
21+
"chocolate",
22+
"kiwi",
23+
];
1124

1225
function mealAssembly(protein, grains, veggies, beverages, desserts, numMeals) {
1326
let pantry = [protein, grains, veggies, beverages, desserts];
1427
let meals = [];
15-
28+
1629
/// Part A #2: Write a ``for`` loop inside this function
1730
/// Code your solution for part A #2 below this comment (and above the return statement) ... ///
1831

19-
2032
return meals;
2133
}
2234

23-
2435
function askForNumber() {
2536
numMeals = input.question("How many meals would you like to make?");
26-
37+
2738
/// CODE YOUR SOLUTION TO PART B here ///
2839

2940
return numMeals;
3041
}
3142

32-
3343
function generatePassword(string1, string2) {
34-
let code = '';
44+
let code = "";
3545

3646
/// Code your Bonus Mission Solution here ///
3747

3848
return code;
3949
}
4050

4151
function runProgram() {
42-
4352
/// TEST PART A #2 HERE ///
4453
/// UNCOMMENT the two lines of code below that invoke the mealAssembly function (starting with 'let meals =') and print the result ///
4554
/// Change the final input variable (aka numMeals) here to ensure your solution makes the right number of meals ///
4655
/// We've started with the number 2 for now. Does your solution still work if you change this value? ///
47-
4856
// let meals = mealAssembly(protein, grains, veggies, beverages, desserts, 2);
4957
// console.log(meals)
50-
51-
5258
/// TEST PART B HERE ///
5359
/// UNCOMMENT the next two lines to test your ``askForNumber`` solution ///
5460
/// Tip - don't test this part until you're happy with your solution to part A #2 ///
55-
5661
// let mealsForX = mealAssembly(protein, grains, veggies, beverages, desserts, askForNumber());
5762
// console.log(mealsForX);
58-
59-
/// TEST PART C HERE ///
63+
/// TEST PART C HERE ///
6064
/// UNCOMMENT the remaining commented lines and change the password1 and password2 strings to ensure your code is doing its job ///
61-
6265
// let password1 = '';
6366
// let password2 = '';
6467
// console.log("Time to run the password generator so we can update the menu tomorrow.")
@@ -74,5 +77,5 @@ module.exports = {
7477
mealAssembly: mealAssembly,
7578
askForNumber: askForNumber,
7679
generatePassword: generatePassword,
77-
runProgram: runProgram
80+
runProgram: runProgram,
7881
};

0 commit comments

Comments
 (0)