Level 3 · Programming Skills · Course 3.1 JavaScript Programming
Module 21: Arrays and Objects
Goal: run JavaScript on your own computer with Node.js, and use arrays and objects to describe real things such as products, customers and orders. By the end you'll have a small product catalogue in code.
You'll need: VS Code, the terminal (Module 8), Git (Module 9), and everything from Level 2's JavaScript modules.
Lessons
- 1Running JavaScript with Node.js, and arrays15–25 minutes✓
- 2Array operations15–25 minutes✓
- 3Objects15–25 minutes✓
- 4Nested data15–25 minutes✓
- 5Modelling real things15–25 minutes✓
🛠️Module practice: Project A, part 1, a product catalogue
In catalogue.js:
- An array of at least eight product objects with
id,name,category,price(in paise), andstock. - Print every product as one line, for example "P001 Notebook (Stationery) ₹60.00, 25 in stock".
- Find a product by id with
find, and print a friendly message if it doesn't exist. - Add a new product and remove one by id, without using
splice(hint: make a new array). - Commit your work with a clear message.
✅Module check
Explain in a few sentences, in your own words:
When would you use an array, when an object, and how would you model products and orders together?
Show a good answer
A good answer mentions: an array is an ordered list of similar things (all the products); an object describes one thing with named properties (one product's name, price, stock). Real data nests them: an array of product objects, an array of orders, each order holding a list of items. Things refer to each other by a unique id rather than copying, so each fact is stored once.
📝Module quiz
10 questions · 10 marks each · 100 marks in all · pass mark 70% · retry as often as you like ·
