Optional Chaining Operator (?.) in JavaScript

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
    @srinivasaraoyp36402 жыл бұрын

    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.

  • @dasdisdus774
    @dasdisdus7745 ай бұрын

    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-pr1ip9 ай бұрын

    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!

  • @fahmidhossainSakib
    @fahmidhossainSakib2 жыл бұрын

    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
    @MinhNgwen2 жыл бұрын

    Great content and examples! Thanks for saving us time!

  • @damianodamian7907
    @damianodamian7907 Жыл бұрын

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

  • @EnzoAuditore
    @EnzoAuditore6 ай бұрын

    Thank you for this mate.

  • @prudhvichinnam1488
    @prudhvichinnam14883 жыл бұрын

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

  • @juliafeller3905
    @juliafeller3905 Жыл бұрын

    Explanation on point! Thanks a lot🙏

  • @thullyodamasceno8639
    @thullyodamasceno8639 Жыл бұрын

    What a great explanation! Really complete tutorial! Thanks!

  • @asheeshmathur
    @asheeshmathur3 жыл бұрын

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

  • @qinisodlamini1139
    @qinisodlamini1139 Жыл бұрын

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

  • @dejanobradovic9723
    @dejanobradovic97232 жыл бұрын

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

  • @jamesbest2221
    @jamesbest22212 жыл бұрын

    This is excellent! (subscribed!)

  • @rangabharath4253
    @rangabharath42533 жыл бұрын

    awesome as always

  • @soraubhsahu2782
    @soraubhsahu27822 жыл бұрын

    Thank you so much your explaining way is quite helpful

  • @martinkarugaba
    @martinkarugaba2 жыл бұрын

    Nice explanation, thanks

  • @captinblack113
    @captinblack113 Жыл бұрын

    Amazing explanation

  • @ohiwantyoutobelieve
    @ohiwantyoutobelieve Жыл бұрын

    Geat content, very clear

  • @sistemazero
    @sistemazero2 жыл бұрын

    Thanks for sharing!

  • @ytpremi3402
    @ytpremi3402 Жыл бұрын

    This help me so much

  • @Minimaos1
    @Minimaos19 ай бұрын

    Thanks man!

  • @KRAMDROIDTECH
    @KRAMDROIDTECH3 жыл бұрын

    Thanks Bro, Very Solid 👌

  • @htethtetoo9126
    @htethtetoo91262 жыл бұрын

    Best tutorial ever

  • @maskman4821
    @maskman48212 жыл бұрын

    awesome explaining 😍

  • @alexpiano
    @alexpiano2 жыл бұрын

    Thank you! worth the time :)

  • @NACOSFOREVER
    @NACOSFOREVER2 жыл бұрын

    Good and clear.

  • @dcode-software

    @dcode-software

    2 жыл бұрын

    Glad it was helpful!

  • @ErmiaAmirabadi
    @ErmiaAmirabadi Жыл бұрын

    thanks man!!!

  • @fethisert5527
    @fethisert55274 ай бұрын

    Thank you sir

  • @sayedpritom
    @sayedpritom2 жыл бұрын

    Thank you :)

  • @kmm_alpha
    @kmm_alpha Жыл бұрын

    Thank you

  • @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

  • @Lik4nGaming
    @Lik4nGaming Жыл бұрын

    Amazing videos, nothing more to say.

  • @jayanthsaikiran6624
    @jayanthsaikiran66242 жыл бұрын

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

  • @farazmobin2776
    @farazmobin27763 жыл бұрын

    which font you are using

  • @esrasumer9894
    @esrasumer9894 Жыл бұрын

    your voice is amazing!

  • @beinyourguard
    @beinyourguard3 жыл бұрын

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

  • @mahmodnasser3262
    @mahmodnasser3262 Жыл бұрын

    amazing

  • @ashmehr4946
    @ashmehr4946 Жыл бұрын

    nice!

  • @zohnannor
    @zohnannor3 жыл бұрын

    there is also optional indexing ?.[]

  • @mohammed.haydar
    @mohammed.haydar3 жыл бұрын

    Great tutorial very helpful 👌🏽❤️

  • @dcode-software

    @dcode-software

    3 жыл бұрын

    Mate, glad it was helpful.

  • @smoothbeak
    @smoothbeak3 жыл бұрын

    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

  • @saminyasar004
    @saminyasar0043 жыл бұрын

    @dcode please tell me what font you are using?

  • @dcode-software

    @dcode-software

    3 жыл бұрын

    Roboto Mono

  • @DeveloperRimon
    @DeveloperRimon2 жыл бұрын

    thanks

  • @dcode-software

    @dcode-software

    2 жыл бұрын

    You're welcome!

  • @minhphucle4117
    @minhphucle41173 жыл бұрын

    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

    3 жыл бұрын

    Thanks man, it's work for me, I am able to use optional chaining now :D

  • @shakilahmed6870
    @shakilahmed68702 жыл бұрын

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

  • @ginot3790
    @ginot37903 жыл бұрын

    Wheres the blue switches mate? :)

  • @bullettime2808
    @bullettime28083 жыл бұрын

    There are a billion different names for this operator

  • @Rickyodus
    @Rickyodus Жыл бұрын

    Why do you keep calling Question mark(?) a dollar sign($)? 😩😄

  • @softwarejobkosam7327
    @softwarejobkosam73273 жыл бұрын

    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

    3 жыл бұрын

    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

Келесі