Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    JSJavaScript

    Getting started

    • What is JavaScript?
    • Variables: let, const and var
    • Data types
    • Type conversion

    Operators and strings

    • Arithmetic and assignment
    • Comparison and logic
    • Strings and template literals
    • String methods
    • Numbers and Math

    Control flow

    • Conditions: if and else
    • switch and the ternary operator
    • Loops: for and while
    • Challenge: FizzBuzz

    Functions

    • Functions
    • Arrow functions
    • Parameters: default, rest and spread
    • Scope and closures
    • Callbacks and higher-order functions

    Arrays

    • Array basics
    • map, filter and find
    • reduce and sorting
    • Destructuring

    Objects

    • Object basics
    • Copies and references
    • Methods and this
    • JSON and optional chaining

    Classes and OOP

    • Classes
    • Inheritance

    JavaScript in the page

    • Controlling the page (DOM)
    • Creating elements
    • Events
    • Forms and validation
    • Saving in the browser (localStorage)

    Errors and async

    • Handling errors: try and catch
    • Timers and the event loop
    • Promises
    • async and await
    • Fetching data from an API

    Practical tools and techniques

    • Searching with regular expressions
    • Cancellation and stale results
    • Testing and debugging JavaScript

    Modern JavaScript and a project

    • Map and Set
    • Dates and localised formatting
    • Modules: import and export
    • Project: a complete to-do app
    JavaScript

    Objects · Lesson 23 of 45

    Object basics

    Group information about one thing in one place.

    8 minutes3 games

    An object groups properties inside { }, each with a name (key) and a value. Read one with a dot, user.name, or brackets, user["name"], when the name is in a variable or has a space.

    • student
      • name: "Youssef"
      • level: 3
      • skills
        • 0: "HTML"
        • 1: "JS"

    Objects can hold arrays and other objects.

    JavaScript
    const student = {
      name: "Youssef",
      level: 3,
      skills: ["HTML", "JS"],
      "favorite color": "blue",
    }
    
    student.level = 4           // change
    student.city = "Cairo"      // add
    delete student.skills       // remove
    
    const key = "name"
    console.log(student[key], student.level, student["favorite color"])
    console.log("city" in student)

    Looping over an object

    JavaScript
    const prices = { tea: 10, coffee: 25, juice: 18 }
    
    console.log(Object.keys(prices))
    console.log(Object.values(prices))
    for (const [drink, price] of Object.entries(prices)) {
      console.log(`${drink}: ${price} EGP`)
    }

    If a variable has the same name as the property, shorten it: const name = "Ali"; const user = { name } equals { name: name }.

    Important

    Even with const you can change an object's properties; you just can't point the variable at a different object.

    Interview question

    How do you count an object's properties?

    Quick question

    How do you read the page count in const book = { pages: 300 }?

    Spot the bug

    One line prints undefined instead of the price. Which?

    Exercise

    Print the sum of every price in the object (53).

    Expected output: 53

    JavaScript
    const prices = { tea: 10, coffee: 25, juice: 18 }
    

    Learn more from

    • javascript.info: Objectsjavascript.info
    • javascript.info: Object.keys, values, entriesjavascript.info
    • MDN: Working with objectsdeveloper.mozilla.org

    Played 0 of 3 games

    Sign in to save your progress and earn XP.

    PreviousDestructuringNextCopies and references
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.