Question: Given an array of users, each represented by an object with the following properties: { name: 'John Doe', age: 35, email: 'john@doe.com', address: { city:

Given an array of users, each represented by an object with the following properties:

{

name: 'John Doe',

age: 35,

email: 'john@doe.com',

address: {

city: 'New York',

state: 'NY'

}

}

Use the forEach method to print the name and email of each user.

Use the map method to create an array of just the names of each user.

Use the optional chaining operator (?.) to safely access the state of each user's address.

Use the rest operator to collect all the remaining properties of each user into a new object.

Use destructuring to extract the name and email of each user into separate variables

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!