You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//3) Query the user to select a cabinet (0 - 3) in the cargoHold.
26
+
letselectCabinet=parseInt(input.question("please select a cabinet(0-3)"));
13
27
14
28
//4) Use bracket notation and a template literal to display the contents of the selected cabinet. If the user entered an invalid number, print an error message.
console.log(`Contents of Cabinet, ${cargoHold[selectCabinet]}`);
32
+
}else{
33
+
console.log(`Invalid cabinet selection. Please select a cabinet between 0 and ${cargoHold.length-1}`);
34
+
}
15
35
16
36
//5) Modify the code to query the user for BOTH a cabinet in cargoHold AND a particular item. Use the 'includes' method to check if the cabinet contains the selected item, then print “Cabinet ____ DOES/DOES NOT contain ____.”
37
+
letselectItem=input.question("Enter an item to check if it's in the cabinet:");
0 commit comments