Array Basics

Array Basics
πŸ‘¨β€πŸ’Ό We're building an inventory system that tracks products. Let's start with basic array operations.
🐨 Open
index.ts
and:
  1. Create a products array of strings starting with exactly: ['Laptop', 'Mouse', 'Keyboard']
  2. Use push to add 'Monitor' at the end
  3. Log the first product (products[0]) and the last product (products[products.length - 1])
  4. Log the total number of products (products.length)
  5. Export products
After the push, products should be ['Laptop', 'Mouse', 'Keyboard', 'Monitor'] (length 4, last item 'Monitor').
πŸ’° Arrays store ordered values; you can push, index, and read length.
πŸ“œ MDN - Array

Please set the playground first

Loading "Array Basics"
Loading "Array Basics"
Login to get access to the exclusive discord channel.
Loading Discord Posts