let itemsArr = ["Milk", "Bread", "Potato"];
let quantityArr = [5, 2, 3];
for (i = 0; i <= itemsArr.length; i++) {
if (i <= itemsArr.length)
console.log(itemsArr[i] + " - " + quantityArr[i]);
}
it should
Print the following result:
Milk - 5
Bread - 2
Potato - 3
but why it is Print the following result:
Milk - 5
Bread - 2
Potato - 3
undefined - undefined
Please help!