Array creation
π Scenario: You are helping a small shop owner keep track of the products they sell. The owner wants to list the products in an array so they can easily add more later.
π― Goal: Create an array of product names and display it.
π What You'll Learn
Create an array called
products with the exact items: "Apples", "Bananas", "Carrots"Create a variable called
newProduct and set it to "Dates"Add
newProduct to the products array using the push methodPrint the
products array to the consoleπ‘ Why This Matters
π Real World
Arrays help store lists of items like products, names, or tasks in many apps and websites.
πΌ Career
Knowing how to create and manage arrays is a basic skill for any programming job involving data handling.
Progress0 / 4 steps