Optional Chaining Operator (?.) in JavaScript

  Рет қаралды 23,340

dcode

dcode

3 жыл бұрын

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:
/ @dcode-software
For your reference, check this out:
developer.mozilla.org/en-US/d...
💜 Join my Discord Server:
/ discord
🎨 Download my Visual Studio Code theme:
marketplace.visualstudio.com/...
Support me on Patreon:
/ dcode
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

Пікірлер: 70
@srinivasaraoyp3640
@srinivasaraoyp3640 2 жыл бұрын
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.
@muhammadhafizh9757
@muhammadhafizh9757 4 ай бұрын
I've watched many videos about optional chaining operator but still don't understand until watch this. Thank you mate, god bless you.
@abdullahkhan-pr1ip
@abdullahkhan-pr1ip 8 ай бұрын
I opened multiple tabs to learn about optional changing operators, but after watching your video, I didn't need to look for others.
@marcospereira-qv1lh
@marcospereira-qv1lh Жыл бұрын
I really liked your video. short, straight to the point, easy to understand. 100% tutorial quality. thanks for the service!
@damianodamian7907
@damianodamian7907 Жыл бұрын
Bloody hell man, you're so good at explaining those concepts! Thank you so much :)
@fahmidhossainSakib
@fahmidhossainSakib 2 жыл бұрын
thanks for comparing the optional operator with the ternary operator of java at 2:46 . It made me understand profoundly.
@dcode-software
@dcode-software 2 жыл бұрын
Glad it could help you 🙂
@MinhNgwen
@MinhNgwen 2 жыл бұрын
Great content and examples! Thanks for saving us time!
@thullyodamasceno8639
@thullyodamasceno8639 Жыл бұрын
What a great explanation! Really complete tutorial! Thanks!
@dejanobradovic9723
@dejanobradovic9723 Жыл бұрын
Best explanation that I found for Optional Chaining Operator! (subed)
@qinisodlamini1139
@qinisodlamini1139 Жыл бұрын
Great video and explanation, I understood the concept in less that 2 minutes.
@juliafeller3905
@juliafeller3905 Жыл бұрын
Explanation on point! Thanks a lot🙏
@EnzoAuditore
@EnzoAuditore 5 ай бұрын
Thank you for this mate.
@prudhvichinnam1488
@prudhvichinnam1488 3 жыл бұрын
Awesome content keep doing this for beginners it's lot a helpful Thankyou👍🙏
@asheeshmathur
@asheeshmathur 2 жыл бұрын
Excellent Tutorial, I was looking for quick solution...God Bless You
@jamesbest2221
@jamesbest2221 2 жыл бұрын
This is excellent! (subscribed!)
@rangabharath4253
@rangabharath4253 3 жыл бұрын
awesome as always
@martinkarugaba
@martinkarugaba 2 жыл бұрын
Nice explanation, thanks
@captinblack113
@captinblack113 Жыл бұрын
Amazing explanation
@soraubhsahu2782
@soraubhsahu2782 2 жыл бұрын
Thank you so much your explaining way is quite helpful
@ohiwantyoutobelieve
@ohiwantyoutobelieve Жыл бұрын
Geat content, very clear
@htethtetoo9126
@htethtetoo9126 2 жыл бұрын
Best tutorial ever
@KRAMDROIDTECH
@KRAMDROIDTECH 3 жыл бұрын
Thanks Bro, Very Solid 👌
@maskman4821
@maskman4821 Жыл бұрын
awesome explaining 😍
@sistemazero
@sistemazero 2 жыл бұрын
Thanks for sharing!
@Minimaos1
@Minimaos1 8 ай бұрын
Thanks man!
@ytpremi3402
@ytpremi3402 Жыл бұрын
This help me so much
@alexpiano
@alexpiano 2 жыл бұрын
Thank you! worth the time :)
@NACOSFOREVER
@NACOSFOREVER 2 жыл бұрын
Good and clear.
@dcode-software
@dcode-software 2 жыл бұрын
Glad it was helpful!
@ErmiaAmirabadi
@ErmiaAmirabadi Жыл бұрын
thanks man!!!
@novanoskillz4151
@novanoskillz4151 Жыл бұрын
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
@mohammed.haydar
@mohammed.haydar 3 жыл бұрын
Great tutorial very helpful 👌🏽❤️
@dcode-software
@dcode-software 3 жыл бұрын
Mate, glad it was helpful.
@beinyourguard
@beinyourguard 3 жыл бұрын
'And "supposedly" I'm 28 years old" I feel ya, man...
@sayedpritom
@sayedpritom 2 жыл бұрын
Thank you :)
@jayanthsaikiran6624
@jayanthsaikiran6624 2 жыл бұрын
Cool vs theme. what font are you using in vs code ?
@Lik4nGaming
@Lik4nGaming Жыл бұрын
Amazing videos, nothing more to say.
@fethisert5527
@fethisert5527 3 ай бұрын
Thank you sir
@esrasumer9894
@esrasumer9894 Жыл бұрын
your voice is amazing!
@smoothbeak
@smoothbeak 3 жыл бұрын
No one seemed to pick up that you kept calling the question marks "dollar signs" haha.
@dcode-software
@dcode-software 3 жыл бұрын
For real? Hahaha
@smoothbeak
@smoothbeak 3 жыл бұрын
@@dcode-software Haha I believe so, unless I'm hearing things, which is possible!
@smoothbeak
@smoothbeak 3 жыл бұрын
@@dcode-software 7:40
@Ctrl_Alt_Elite
@Ctrl_Alt_Elite 2 жыл бұрын
@@smoothbeak lol completely went over my head somehow 🤯😂
@vinade2100
@vinade2100 2 жыл бұрын
I had to find your comment just to confirm I am not going insane xD
@kmm_alpha
@kmm_alpha Жыл бұрын
Thank you
@ashmehr4946
@ashmehr4946 Жыл бұрын
nice!
@mahmodnasser3262
@mahmodnasser3262 Жыл бұрын
amazing
@farazmobin2776
@farazmobin2776 3 жыл бұрын
which font you are using
@shakilahmed6870
@shakilahmed6870 2 жыл бұрын
You must have mentioned that what you have shown in 2:45 is called ternany operator
@zohnannor
@zohnannor 3 жыл бұрын
there is also optional indexing ?.[]
@saminyasar004
@saminyasar004 2 жыл бұрын
@dcode please tell me what font you are using?
@dcode-software
@dcode-software 2 жыл бұрын
Roboto Mono
@DeveloperRimon
@DeveloperRimon Жыл бұрын
thanks
@dcode-software
@dcode-software Жыл бұрын
You're welcome!
@ginot3790
@ginot3790 3 жыл бұрын
Wheres the blue switches mate? :)
@minhphucle4117
@minhphucle4117 3 жыл бұрын
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 =
@quanganhnguyen7252
@quanganhnguyen7252 3 жыл бұрын
same here. can't use optional chaning in vscode
@quanganhnguyen7252
@quanganhnguyen7252 3 жыл бұрын
disable html formatter in extension can fix this
@minhphucle4117
@minhphucle4117 2 жыл бұрын
Thanks man, it's work for me, I am able to use optional chaining now :D
@bullettime2808
@bullettime2808 3 жыл бұрын
There are a billion different names for this operator
@Rickyodus
@Rickyodus Жыл бұрын
Why do you keep calling Question mark(?) a dollar sign($)? 😩😄
@softwarejobkosam7327
@softwarejobkosam7327 3 жыл бұрын
Super bro..from india...my suggestion.. please speak in slow for clear understanding of your English.. Do complete javascript tutorial
@bullettime2808
@bullettime2808 3 жыл бұрын
My suggestion: learn English
@softwarejobkosam7327
@softwarejobkosam7327 3 жыл бұрын
@@bullettime2808 as a youtube r ...take suggestion s positively.....it's good for your channel improvement.. 👍
@smoothbeak
@smoothbeak 3 жыл бұрын
I feel as though he already speaks quite slowly (and clearly too)
@billsmoke3929
@billsmoke3929 2 жыл бұрын
Not to be rude but he is speaking clearly and slowly
@damianodamian7907
@damianodamian7907 Жыл бұрын
His way of explaining is crystal clear I would say. I personally find difficult to understand English spoken by Indians. Probably is the same the way around. Use subtitles, it will help you
Maps vs. Objects in JavaScript - What's the Difference?
11:48
⬅️🤔➡️
00:31
Celine Dept
Рет қаралды 47 МЛН
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 3 МЛН
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 51 МЛН
5 MUST KNOW JavaScript DOM Methods
7:02
dcode
Рет қаралды 16 М.
Tips For Using Async/Await in JavaScript
16:26
James Q Quick
Рет қаралды 394 М.
Optional Chaining Operator in JavaScript, Simplified
8:55
Deeecode The Web
Рет қаралды 604
Another 5 Must Know JavaScript Features That Almost Nobody Knows
22:42
Web Dev Simplified
Рет қаралды 213 М.
JavaScript "this" Keyword Explained
7:55
dcode
Рет қаралды 12 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Why I Don't Use Else When Programming
10:18
Web Dev Simplified
Рет қаралды 1,2 МЛН
Javascript Nuggets - Optional Chaining
7:17
Coding Addict
Рет қаралды 16 М.
⬅️🤔➡️
00:31
Celine Dept
Рет қаралды 47 МЛН