JavaScript Starter · free course

Free course · Lesson 3 of 5

Arrays & Objects

In this lesson you will

  • Store data in arrays and objects
  • Use array methods such as map and filter

Arrays hold ordered lists of values; objects hold labeled data as key-value pairs — JavaScript's equivalent of a Python dict or a Java HashMap. Together they can represent almost any real-world data.

  • const students = ["Amina", "Deng", "Grace"]; — a simple array.
  • const student = { name: "Amina", level: "Beginner", score: 78 }; — an object.
  • Destructuring: const { name, score } = student; pulls fields out directly.
  • JSON.stringify() and JSON.parse() convert between objects and text — essential for APIs.

💡 Practical Skill: Model real records as an array of objects — this is exactly the shape of data returned by most web APIs as JSON.

Worked exampleFiltering Student Records
JavaScript
const students = [  { name: "Amina", level: "Beginner", score: 78 },  { name: "Deng", level: "Intermediate", score: 91 },  { name: "Grace", level: "Beginner", score: 64 },]; const passed = students  .filter((s) => s.score >= 70)  .map((s) => s.name); console.log("Passed:", passed); const levelsOffered = [...new Set(students.map((s) => s.level))];console.log("Levels in this class:", levelsOffered);

Practice exercise

Create an array of product objects with names and prices, then use filter to list the products under 5,000 SSP.

Key takeaways

  • Real data is usually an array of objects
  • map transforms, filter selects and reduce combines
  • Array methods return new arrays and leave the original unchanged
In the full program Module 3: Arrays, Objects and Array Methods See how this topic is taught in depth, with practical activities and an assessment.

Free self-study lesson — no certificate. For the full instructor-led program, see registration options.