JavaScript · Lesson 6 of 8
Arrays & objects
Lists and key/value data, plus map, filter and find.
An array is an ordered list: const jobs = ["QA", "Dev"]. Index from 0: jobs[0]. Use push to add, length to count.
An object groups named values: const job = { title: "Dev", city: "Kochi" }, read with job.title.
Array methods you'll use daily:
map— transform every item.filter— keep items that match.find— first match.reduce— combine into one value.
Try it yourself
Edit the code and press Run (or Ctrl/⌘ + Enter). Code runs only in your browser, in a sandbox.
Key points
- Arrays start at index 0.
- Objects use key: value pairs.
- map / filter / find / reduce replace most loops.
Quick check
Which method keeps only the items that pass a test?
filter returns a new array with only the items for which the callback returns true.
Practice task
From the jobs array, build a new array of strings like 'QA Engineer — Kochi' using map.
Interview corner
map vs forEach?
map returns a new array of transformed values; forEach just runs a function for each item and returns undefined.
How do you copy an object or array?
Shallow copy with spread ({...obj}, [...arr]). For a deep copy use structuredClone(obj).
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.