Sign in
Log inSign up
Insha Ramin

100 likes

·

1.5K reads

26 comments

Ayodele Samuel Adebayo
Ayodele Samuel Adebayo
Aug 13, 2021

Wonderful article.

The optional chaining with function calls stood out for me.

Thanks a lot for sharing.

Suggestions:

In the example

let nestedProp = user.firstName?.lastName;

IMO I feel lastName cannot be gotten from firstName.

The example can be much clearer with user.names.lastName instead to make the example much realistic.

Overall I enjoyed every bit of the article 😊

2
·
·3 replies
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you for the kind words, Samuel. Appreciate the suggestion. 😊

What I feel is :

Here it'll implicitly check to be sure user.firstName is not null or undefined before attempting to access user.firstName.lastName. If user.firstName is null or undefined, the expression automatically short-circuits, returning undefined.

·
Ayodele Samuel Adebayo
Ayodele Samuel Adebayo
Aug 13, 2021

Sure, I'm aware of the logic Insha Ramin

But talking about the user object structure.

This means you're saying the user structure is 👇

const user = {

firstName: {
lastName: "Insha"
}

}

What I'm saying 👇

const user = {

names: {
firstName: "Insha",
lastName: "Ramin"
}

}

So we can check if the name object exist before accessing the firstName or lastName.

I mean your lastName cannot be inside your firstName 😬.

I hope this explains the structure I'm talking about.

·
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Got your point. Ayodele Samuel Adebayo

I guess this got a little bit confusing but the case wasn't this. Anyways I appreciate you taking out the time to highlight this.😄

1
·
Ronnie
Ronnie
Aug 13, 2021

This is the best explanation, I've ever seen on this topic. Keep up the good work Ina. 😁😁😁

2
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 14, 2021

Thank you, Ronnie. 😊🔥

·
sintu sagar
sintu sagar
Aug 13, 2021

Best explanation ⚡⚡on this Topic , well done 👏

2
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you for reading, Sintu. Glad to hear it was a great read for you 😃

·
Suprabha Supi
Suprabha Supi
Aug 13, 2021

Its quite detail explained Insha Ramin

Thanks for sharing 🔥

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you Suprabha Supi. Glad you liked the article! 😊💙

·
Musarrat Jabeen
Musarrat Jabeen
Aug 13, 2021

Thanks for putting this. Loved the article and the way you explained the concept 🔥👏

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Ah, glad to hear this. Thank you for reading😊⚡

·
Faheem Khan
Faheem Khan
Aug 13, 2021

I like detailed explanation. Well done, Insha Ramin

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you, Faheem. 🤗

1
·
Bello Ololade
Bello Ololade
Aug 13, 2021

Great read Insha 🔥

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you so much, Olo🔥🤗

·
Tapas Adhikary
Tapas Adhikary
Aug 13, 2021

Good one Insha Ramin, detailed explanation. I love using it now a lot.

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you so much for reading the article. Glad you liked it 🤗

·
Krishna Gupta
Krishna Gupta
Aug 13, 2021

Great read, Detailed explanation 🔥🔥🔥

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 13, 2021

Thank you, Krishna💙

·
Deeksha Deepak
Deeksha Deepak
Aug 13, 2021

Thank you for this detailed explanation Insha, great work😃

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 14, 2021

Thank you, Deeksha! Glad you found it helpful💙

·
Kritika Pattalam Bharathkumar
Kritika Pattalam Bharathkumar
Aug 13, 2021

Well explained. Thank you!!

1
·
·1 reply
Insha Ramin
Insha Ramin
Author
·Aug 14, 2021

Glad to hear that, Kritika 😊

·
SUMIT BHOWMICK
SUMIT BHOWMICK
Aug 14, 2021

Amazingly explained ✌️💥

·
Vishal
Vishal
Aug 15, 2021

Wow insha,

Really like your blog, keep writing

Waiting for next 🙌👍😃

·