Помощ при задача Moving while-loop exercise. Благодаря предварително!
function solve(input) {
let width = Number(input.shift());
let length = Number(input.shift());
let heigth = Number(input.shift());
let volume = width * length * heigth;
let movedCartons = 0;
while(true) {
numCartons = input.shift();
if(Number(numCartons) || numCartons == "undefined" || numCartons == "Done") {
break;
} else {
movedCartons += numCartons;
}
}
if(movedCartons > volume) {
console.log(`No more free space! You need ${Math.abs(movedCartons - volume)} Cubic meters more.`);
} else {
console.log(`${Math.abs(movedCartons - volume)} Cubic meters left.`);
}
}