Tell us what’s happening:
Your code so far
const myList =
["Chocolate Bar", ["QTY",1],
"Milk Cartons", ["QTY",1],
"eggs", ["QTY", 30],
"Peanut butter", ["QTY", 2],
"Chicken mix", ["QTY", 3 ]];
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.96.36.199 Safari/537.36
Link to the challenge:
Please Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!
The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity i.e.
Let’s check your first sub-array and see if it meets the requirements.
The first sub-array is:
["Chocolate Bar", ["QTY",1]
Is the first element of the sub-array a string containing a name?
"Chocolate Bar" is a string.
Is the second element a number representing the quantity?
No, it is an array (
["QTY",1]) with the first element a string (
QTY) and the second element a number.
Now that you know what the second sub-array is compared to what it is supposed to be, see if you can solve the challenge now.