Shopping List
JavaScript
10 pts
Shopping List
Senait’s shopping list starts as ["milk", "tea", "sugar"].
- Add
"bread"and then"eggs"to the end withpush(). - She buys the first item: remove it with
shift()and keep it in aconstcalledbought. - Print what she bought and the rest of the list joined with
", ".
Bought: milk List: tea, sugar, bread, eggs
Checklist
- Add
"bread"and"eggs"at the end. - Remove the first item and keep it in
bought. - Turn the list into one line of text with
join. - Print the two lines.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
