Assignment
Create a shopping list program that:
- Creates an array of at least 5 items (strings) that you need to buy
- Uses a
forloop to display each item with its index number (e.g., "1. Apples", "2. Bread") - Uses
forEachto display all items again, but this time with a checkmark emoji (✓) before each item - Uses a
whileloop to count and display the total number of items in the list - Uses
filterto create a new array containing only items that have more than 4 characters, then display this filtered list
Requirements:
- Use proper array methods (forEach, filter)
- Display results using both console.log() and document.write()
- Use template literals for string formatting
- Use an external JavaScript file (script.js) linked to your HTML
Create an index.html file and a script.js file with your solution.