0
0
Javascriptprogramming~15 mins

Adding and removing properties in Javascript - Mini Project: Build & Apply

Choose your learning style9 modes available
Adding and removing properties
πŸ“– Scenario: You are managing a simple contact list where each contact is an object with properties like name and phone number.
🎯 Goal: You will create a contact object, add a new property to it, remove an existing property, and then display the final contact details.
πŸ“‹ What You'll Learn
Create an object called contact with properties name and phone.
Add a new property called email to the contact object.
Remove the phone property from the contact object.
Print the final contact object.
πŸ’‘ Why This Matters
🌍 Real World
Managing contact information in apps or websites often requires adding or removing details dynamically.
πŸ’Ό Career
Understanding how to manipulate object properties is essential for frontend and backend developers working with user data.
Progress0 / 4 steps
1
Create the initial contact object
Create an object called contact with these exact properties and values: name set to "Alice" and phone set to "123-456-7890".
Javascript
Need a hint?

Use curly braces {} to create an object and separate properties with commas.

2
Add an email property
Add a new property called email to the contact object and set it to "alice@example.com".
Javascript
Need a hint?

Use dot notation to add a new property to an object.

3
Remove the phone property
Remove the phone property from the contact object using the delete keyword.
Javascript
Need a hint?

Use delete object.property to remove a property from an object.

4
Display the final contact object
Print the contact object to the console using console.log.
Javascript
Need a hint?

Use console.log(contact) to see the object in the console.