---
# System prepended metadata

title: 'Unit 1: Lesson 3 - Coding Lab (Objects)'
tags: ['''23-''24']

---

# Unit 1: Lesson 3 - Coding Lab (Objects)

## Objective

In the digital age of 2023, Finstagram, a revolutionary social app set to replace Instagram, seeks your expertise in designing JavaScript objects to power their Direct Messaging (DM) feature. This lab will focus on creating and manipulating objects to fulfill the requirements of the DM feature.

## Instructions

### Part 1: User Profiles [2 pts]

1. Create a variable named `userProfile1`.
2. Inside this variable, store an object with the following key-value pairs:

    | Key       | Value                        |
    | --------- | ---------------------------- |
    | name      | "Jane Doe"                   |
    | username  | "janeDoe123"                 |
    | age       | 28                           |
    | friends   | ["johnSmith456", "aliceGreen789"] |
    - **[1.3: 0.5 pt]**

3. Create a variable named `userProfile2`.
4. Inside this variable, store an object with the following key-value pairs:

    | Key       | Value                        |
    | --------- | ---------------------------- |
    | name      | "John Smith"                 |
    | username  | "johnSmith456"               |
    | age       | 32                           |
    | friends   | ["janeDoe123", "aliceGreen789"] |
    -  **[1.3: 0.5 pt]**

5. Use `console.log()` and object dot notation to display the name and usernames of both `userProfile1` and `userProfile2`.
    -  **[1.3: 1 pts]**

### Part 2: User Messages [2 pts]

1. Create a variable named `message1`.
2. Inside this variable, store an object with the following key-value pairs:

    | Key       | Value                                          |
    | --------- | ---------------------------------------------- |
    | sender    | "janeDoe123"                                   |
    | recipient | "johnSmith456"                                |
    | text      | "Hey John, how's it going?"                    |
    | timestamp | "2023-09-15T10:30:00Z" (use a valid timestamp) |
    - **[1.3: 0.5 pt]**

3. Create a variable named `message2`.
4. Inside this variable, store an object with the following key-value pairs:

    | Key       | Value                                          |
    | --------- | ---------------------------------------------- |
    | sender    | "johnSmith456"                                |
    | recipient | "janeDoe123"                                   |
    | text      | "Hi Jane, I'm doing well. How about you?"      |
    | timestamp | "2023-09-15T11:15:00Z" (use a valid timestamp) |
    - **[1.3: 0.5 pt]**

5. Use `console.log()` and object dot notation to display the sender of `message1` and its text.
    -  **[1.3: 0.5 pt]**
7. Use `console.log()` and object dot notation to display the sender of `message2` and its text.
    -  **[1.3: 0.5 pt]**

### Extra Credit [2 pts]

1. Create a variable named `message3`.
2. Inside this variable, store an object with the following key-value pairs:
    - sender: "aliceGreen789"
    - recipient: "janeDoe123"
    - text: "Hey Jane, do you want to grab coffee later?"
    - timestamp: "2023-09-15T13:45:00Z" (use a valid timestamp)

3. Create a variable named `message4`.
4. Inside this variable, store an object with the following key-value pairs:
    - sender: "janeDoe123"
    - recipient: "aliceGreen789"
    - text: "Sure, Alice! Let's meet at the usual place."
    - timestamp: "2023-09-15T14:20:00Z" (use a valid timestamp)

5. Add both `message3` and `message4` to the `userProfile1`'s `DMs` property using array methods.
    - **[1.3: 1 pt]**
7. Use `console.log()` to display the updated `DMs` property of `userProfile1`.
    - **[1.3: 1 pt]**
