Liliana797979

shopping - problem 2 - mid exam

Jul 18th, 2021
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve2(input) {
  2.     let newArray = input[0].split(", ");
  3.  
  4.     let command = newArray.shift();
  5.     let biscuits = [];
  6.  
  7.     while (command !== "No More Money") {
  8.         if(command === "OutOfStock") {
  9.            console.log(`None`);
  10.         } else if (command === "Required") {
  11.             let index1 =
  12.         } else if (command === "Last") {
  13.             biscuits.push(index[1]);
  14.         }
  15.         command = newArray.shift();
  16.     }
  17. }
  18.  
  19. solve2((["Vanilla, Chocolate, Raspberry, Chocolate ",
  20. "OutOfStock Chocolate",
  21. "Required BBB 3",
  22. "No More Money"]));
Advertisement
Add Comment
Please, Sign In to add comment