@@ -34,7 +34,11 @@ let desserts = ['apple', 'banana', 'more kale', 'ice cream', 'chocolate', 'kiwi'
34
34
35
35
function askForNumber ( ) {
36
36
numMeals = input . question ( "How many meals would you like to make?" ) ;
37
+ while ( numMeals > 6 || numMeals < 1 || isNaN ( numMeals ) ) {
38
+ numMeals = input . question ( "enter a number between 1 and 6" )
37
39
40
+ return numMeals
41
+ }
38
42
/// CODE YOUR SOLUTION TO PART B here ///
39
43
40
44
return numMeals ;
@@ -56,16 +60,16 @@ function runProgram() {
56
60
/// Change the final input variable (aka numMeals) here to ensure your solution makes the right number of meals ///
57
61
/// We've started with the number 2 for now. Does your solution still work if you change this value? ///
58
62
59
- let meals = mealAssembly ( protein , grains , veggies , beverages , desserts , 2 ) ;
60
- console . log ( meals )
63
+ // let meals = mealAssembly(protein, grains, veggies, beverages, desserts, 2);
64
+ // console.log(meals)
61
65
62
66
63
67
/// TEST PART B HERE ///
64
68
/// UNCOMMENT the next two lines to test your ``askForNumber`` solution ///
65
69
/// Tip - don't test this part until you're happy with your solution to part A #2 ///
66
70
67
- // let mealsForX = mealAssembly(protein, grains, veggies, beverages, desserts, askForNumber());
68
- // console.log(mealsForX);
71
+ let mealsForX = mealAssembly ( protein , grains , veggies , beverages , desserts , askForNumber ( ) ) ;
72
+ console . log ( mealsForX ) ;
69
73
70
74
/// TEST PART C HERE ///
71
75
/// UNCOMMENT the remaining commented lines and change the password1 and password2 strings to ensure your code is doing its job ///
0 commit comments