Optional Chaining Operator (?.) in JavaScript

preview_player
Показать описание
The optional chaining operator in JavaScript is convenient as it allows the developer to specify an object's property as being optional, and only return a value if the specified property is not "null" or "undefined" - otherwise return "undefined".

It's helpful when accessing data from an API, or generally where you're not too sure what data will look like, or knowing where optional fields exist. It can also be used in combination with the nullish coalescing operator to provide smart defaults 🙂

Join this channel to get access to perks:

For your reference, check this out:

💜 Join my Discord Server:

🎨 Download my Visual Studio Code theme:
Support me on Patreon:

Follow me on Twitter:
@dcodeyt

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

#dcode #javascript
Рекомендации по теме
Комментарии
Автор

Uptill now, I have seen many video demo's on optional chaining operator. Your demo is excellent, in addition to it, you have covered so many topics, one after the other. Thank you very much.

srinivasaraoyp
Автор

I've watched many videos about optional chaining operator but still don't understand until watch this. Thank you mate, god bless you.

dasdisdus
Автор

I opened multiple tabs to learn about optional changing operators, but after watching your video, I didn't need to look for others.

abdullahkhan-prip
Автор

I really liked your video. short, straight to the point, easy to understand. 100% tutorial quality. thanks for the service!

marcospereira-qvlh
Автор

Thanks for this very clear understanding of what optional chaining is!

ZeeshanHafiz-xhwq
Автор

thanks for comparing the optional operator with the ternary operator of java at 2:46 . It made me understand profoundly.

fahmidhossainSakib
Автор

Bloody hell man, you're so good at explaining those concepts! Thank you so much :)

damianodamian
Автор

Great content and examples! Thanks for saving us time!

MinhNgwen
Автор

'And "supposedly" I'm 28 years old"
I feel ya, man...

beinyourguard
Автор

Best explanation that I found for Optional Chaining Operator! (subed)

dejanobradovic
Автор

Great video and explanation, I understood the concept in less that 2 minutes.

qinisodlamini
Автор

You must have mentioned that what you have shown in 2:45 is called ternany operator

shakilahmed
Автор

Awesome content keep doing this for beginners it's lot a helpful Thankyou👍🙏

prudhvichinnam
Автор

What a great explanation! Really complete tutorial! Thanks!

thullyodamasceno
Автор

No one seemed to pick up that you kept calling the question marks "dollar signs" haha.

smoothbeak
Автор

i have been using ? at work without really knowing what it does (the linter just tells me to add it). this video was very helpful. thanks

novanoskillz
Автор

Excellent Tutorial, I was looking for quick solution...God Bless You

asheeshmathur
Автор

Cool vs theme.
what font are you using in vs code ?

jayanthsaikiran
Автор

My vscode keep adding space before and after my question mark so i can't use the optional chaining.Do you know how to fix that?Pls help me =<

minhphucle
Автор

There are a billion different names for this operator

bullettime
visit shbcf.ru