Tell us what’s happening:
I don’t exactly understand what the groupByZone function is supposed to do, the wording of some problems in general is confusing and sometimes incomplete (no hate
).Please advise on how to proceed
Your code so far
function parseShipment(arr) {
let myArr = [];
let ultArr = [];
for (let ele of arr) {
myArr.push(ele.split("|"))
}
for (let elem of myArr) {
let newObj = {};
newObj.sku = elem[0];
newObj.name = elem[1];
newObj.qty = Number(elem[2]);
newObj.expires = elem[3];
newObj.zone = elem[4];
if (elem[4] === undefined) {newObj.zone = "general"}
ultArr.push(newObj)
}
return ultArr
}
function planRestock(pantry, shipment) {
let myArr = [];
for (let i = 0; i < shipment.length; i++) {
let myObj = {};
myObj.type = "donate";
for (let y = 0; y < pantry.length; y++) {
if (shipment[i].sku === pantry[y].sku) {
myObj.type = "restock"
}
}
if (shipment[i].qty <= 0) {
myObj.type = "discard"
}
myObj.item = shipment[i];
myArr.push(myObj)
}
return myArr
}
function groupByZone(actions) {
}
function clonePantry(pantry) {
let newArr = structuredClone(pantry);
return newArr
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Challenge Information:
Build a Smart Pantry Restocker - Build a Smart Pantry Restocker