shamsmosowi / git-bot

0 stars 0 forks source link

accessing nested field #15

Open shamsmosowi opened 1 year ago

shamsmosowi commented 1 year ago

how do i access the city for objects like these

{user:{ school:{ city:"bali" } }}

shamsmosowi commented 1 year ago

Hi,

You can access the city field in the objects using the dot notation. The dot notation is a way of accessing the properties of an object. To access the city field, you would use the following code:

let city = user.school.city;

The variable city will now contain the value of the city field which is "bali".

I hope this helps!