HackIndia Logo
HackathonsNewsSkillsGrowth
HackIndia LogoContact: +91 9910125804

General

  • Companies
  • Colleges
  • Board of Advisors
  • Brand Ambassadors
  • FAQ
  • Contact
  • Report a Bug

Hackathons

  • Upcoming Hackathons
  • Judges
  • Mentors
  • Partners
  • Participating Colleges

Resources

  • About Us
  • Branding
  • Latest News
  • Growth
  • Skills
  • Ecosystem
  • Forum
  • Ideas
  • Prompt Optimizer
  • How to earn XP

© 2026 HackIndia. All rights reserved.

Privacy PolicyTerms of ServiceCode of ConductSitemap

Build 2.139 · 09 Nov 2026, 10:59 UTC

    HackIndia
    HackathonsNewsInternshipsSkillsGrowth
    JavaScriptWorking towardsJavaScript
    0%

    0 of 10 steps done · +100 XP · +50 SHARP when it is yours

    1. 1Stop Copying, Start Reading4 min · +10 XP · +5 SHARP
    2. 2Values, Types, And Checks4 min · +10 XP · +5 SHARP
    3. 3Arrays And Objects Together5 min · +10 XP · +5 SHARP
    4. 4Functions And Scope4 min · +10 XP · +5 SHARP
    5. 5Array Methods That Matter5 min · +10 XP · +5 SHARP
    6. 6Async, Await, And Fetch4 min · +10 XP · +5 SHARP
    7. 7Modules And Project Shape5 min · +10 XP · +5 SHARP
    8. 8Ship The Repo Project5 min · +10 XP · +5 SHARP
    9. The check10 questions, 7 to pass · +10 SHARP
    10. Hand in the taskA project that uses the skill
    11. Skill and certificate+100 XP · +50 SHARP
    Lesson 3 of 8 5 min

    JavaScript

    Arrays And Objects Together

    • +10 XP for this lesson
    • +100 XP when the skill is proved
    • 8 learning it right now
    In 30 seconds
    • Store related data as objects, and lists of those objects as arrays.
    • Read, add, update, and remove items without guessing at the shape.
    Create sample data for your hackathon repo that later works with fetch.
    Key point

    The core shape

    Most JavaScript project data is not just an array or just an object. It is usually an array of objects.

    An object describes one thing. An array holds many things. If you get this shape right, your code becomes easier to read, test, and later replace with API data.

    Example

    Project data example

    Think of a hackathon project that tracks college events. One event is an object. The full event list is an array.

    This same shape could later come from fetch. For now, keep it as sample data in your code.

    const events = [
      {
        id: 1,
        title: "AI Workshop",
        college: "SRM Chennai",
        fee: 0,
        tags: ["ai", "beginner"],
        registered: true
      },
      {
        id: 2,
        title: "UPI App Build Sprint",
        college: "Pune Institute",
        fee: 199,
        tags: ["fintech", "javascript"],
        registered: false
      }
    ];
    
    console.log(events[0].title);        // AI Workshop
    console.log(events[1].tags[0]);      // fintech

    Read the shape first

    Before writing logic, ask: what is one item, and what is the list? Draw it in comments if needed.

    Use names that show the shape. event is one object. events is an array. This small habit prevents many bugs.

    Your to-do

    Common operations

    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

    Example

    Add and update

    In real projects, users add or change data. Practise that with sample objects before you connect an API.

    Notice that the update uses id, not index. Index can change when the list is sorted or filtered.

    const events = [
      { id: 1, title: "AI Workshop", fee: 0, registered: true },
      { id: 2, title: "UPI App Build Sprint", fee: 199, registered: false }
    ];
    
    const newEvent = {
      id: 3,
      title: "Resume Review Camp",
      fee: 49,
      registered: false
    };
    
    const updatedEvents = [...events, newEvent];
    
    const eventIdToRegister = 2;
    
    const afterRegistration = updatedEvents.map((event) => {
      if (event.id === eventIdToRegister) {
        return { ...event, registered: true };
      }
    
      return event;
    });
    
    console.log(afterRegistration);
    Common mistake

    Do not mix shapes

    A common beginner mistake is changing the data shape halfway. For example, fee is a number in one object and "free" as text in another.

    Pick one shape and stay with it. Use fee: 0 for free events. Use registered: true or false, not "yes" and "no".

    Tip

    Use AI carefully

    You can ask ChatGPT or Gemini to create sample data for your project. Ask for an array of objects with exact fields.

    Then check every object yourself. Make sure field names match, ids are unique, and values use the same types.

    Prompt:
    Create 8 sample events for a JavaScript college hackathon app.
    Return only a JavaScript array of objects.
    Each object must have: id number, title string, college string, fee number, tags array of strings, registered boolean.
    Your to-do

    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

    Quick check

    0 of 2 right
    1.You are storing many college events. What shape should you usually use?
    2.Why update an event by id instead of array index?

    Answer the quick check to finish this lesson.

    ← Lesson 2Skip to lesson 4 →
    JavaScript
    Working towards
    JavaScript +100 XP

    0 of 8 lessons done · proved by a project that uses the skill

    See the track