Choose by result
Do not start with the method name. Start with the result you need.
Use map to change every item. Use filter to keep some items. Use find to get one item. Use some to check if at least one item matches. Use reduce when you need one final value from many items.
Why this matters
Hackathon projects usually get data as arrays of objects: events, expenses, tasks, colleges, products, users, or API results.
If your code uses clear array methods, a reviewer can read your logic fast. That helps when your GitHub repo is checked for internship shortlists.
Pick the method
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done
Common project data
Imagine a simple student event planner. Your project may fetch this later. For now, practise on local data.
const events = [
{ id: 1, title: "AI Meetup", city: "Bengaluru", fee: 0, seats: 12 },
{ id: 2, title: "JS Workshop", city: "Pune", fee: 299, seats: 0 },
{ id: 3, title: "Design Jam", city: "Bengaluru", fee: 149, seats: 5 }
];
const eventCards = events.map((event) => ({
id: event.id,
label: `${event.title} - ₹${event.fee}`,
available: event.seats > 0
}));
const freeEvents = events.filter((event) => event.fee === 0);
const puneEvent = events.find((event) => event.city === "Pune");
const hasSoldOutEvent = events.some((event) => event.seats === 0);
const totalSeats = events.reduce((sum, event) => sum + event.seats, 0);
console.log(eventCards);
console.log(freeEvents);
console.log(puneEvent);
console.log(hasSoldOutEvent);
console.log(totalSeats);Do not mutate blindly
Methods like map and filter return new arrays. That is usually safer for project code because your original data stays unchanged.
sort changes the original array. If you need sorting, copy first.
const sortedByFee = [...events].sort((a, b) => a.fee - b.fee);
console.log(sortedByFee);
console.log(events); // original order is still safeName the callback
A good callback name makes your code read like English. This is better than writing short names everywhere.
If AI gives you code with x, y, item1, or data2, rename them before you commit.
const bengaluruEvents = events.filter((event) => event.city === "Bengaluru");
const titles = bengaluruEvents.map((event) => event.title);Check AI output
You can ask an AI tool to suggest array methods for a task. Do not paste the answer directly.
Check three things: does the method return the shape you need, does it mutate the original array, and are edge cases handled, like an empty array or no match from find.
Do this now
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done