JavaScript Tutorial

Arrays and Objects

Model collections and structured records with arrays and objects.

Concept

Arrays are ordered lists and provide methods for adding, finding, filtering and transforming items. Objects group named properties and methods.

Destructuring and spread syntax are common modern patterns for reading and copying data without verbose indexing.

Example

const student = { name: "Asha", skills: ["HTML", "CSS", "JS"] };
const { name, skills } = student;
console.log(name, skills.join(", "));
Type the example yourself and change at least one value. Small experiments reveal syntax and behavior faster than passive reading.

Practice Tasks

  1. Create an array of course objects.
  2. Filter courses by category.
  3. Use destructuring to read two properties.

Key Takeaways

  • Arrays fit ordered collections.
  • Objects fit named records.
  • Use array methods to express transformations clearly.