Promises - Javascript In Depth

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024

ความคิดเห็น • 68

  • @emacsultron6212
    @emacsultron6212 11 หลายเดือนก่อน +6

    Fantastic set of videos in your channel, Nader. And all free! I'm really excited in any backend, testing and finally, system design series that you may have planned (I hope that's the case).
    Excellent, clear (lovely) voice, easy, friendly pace, beginner friendly explanations, and just enough repetition so that the concepts stick!

    • @TechWithNader
      @TechWithNader  11 หลายเดือนก่อน +1

      Thanks! Yes, that's exactly the plan as I"m working on the REST API series right now (backend in Deno). Then I hope to get some of the Computer Science and design topics as well, and maybe some python/AI too soon 😊

    • @senniagordinskaya4051
      @senniagordinskaya4051 2 หลายเดือนก่อน

      @@TechWithNader Nader, I hope to see all these courses on your channel!

  • @properwaffles
    @properwaffles ปีที่แล้ว +7

    Only a third of the way through and already love how you present this stuff. Keep it up, please! 🙌🏻

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Thanks, that means a lot! That's the plan :)

  • @644sixfortyfour4
    @644sixfortyfour4 ปีที่แล้ว +3

    Very neat way to explain Promises, especially the ice cream store. Thank you!

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      You’re welcome! I’m glad it made sense, especially with my beautiful drawing skills, haha! 🥳

  • @mycg-09
    @mycg-09 ปีที่แล้ว +2

    Hi Nader, I am so grateful I came across your videos. I've been studying Promises for weeks with my bootcamp and watched many tutorials on TH-cam. I like the way you explain every step of Promises, the diagram really helped too, and the ice cream analogy with the bear analogy lol.
    When you explained the order of code execution in the Fulfilled Promise Code chapter really unlocked a fundamental part of Promises I was not understanding from other videos I'd watched. Especially how you laid out what gets passed through .then, that it's the resolvedValue from resolve() - so clearly explained! Thank you!

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Hey, and thanks for sharing this! I'm glad you got some good learnings (and amusement) out of the visuals and analogies, haha! 🥳

  • @simplyskandi5973
    @simplyskandi5973 ปีที่แล้ว +8

    Absolutely brilliant explanation on promises. The best on the internet and I have gone through many videos and articles on promises alone. I thought I understood them but you took time in explaining all the nitty gritty details which makes everything absolutely clear. Please keep teaching and keep making these videos. Any plans for JS projects. I feel like I have a decent enough handle on the theory but would love simple projects where we can apply this theory. Thank you so much.

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +4

      Wow, thanks for the praise it means a lot! That’s the intention of these videos and series so I’m glad it’s coming across 😊
      I’ll be making a project or set of projects for this second half soon after a few more videos and topics are covered. Will be relying heavily on promises because they are the bread and butter of working practically with JS haha, so can’t wait! 🤓
      Let me know if you have any recommendations for future content!

    • @simplyskandi5973
      @simplyskandi5973 ปีที่แล้ว

      You deserve it, top notch content! This is my personal opinion, could be wrong but I feel that there aren’t clear enough tutorials on Node JS. There seems to be a gap. It’d be great if you could keep that in mind when planning future content. I would love for you to teach it.

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      @@simplyskandi5973 Will do!

  • @fabioescobar5463
    @fabioescobar5463 ปีที่แล้ว +3

    Finally I kinda understand asynchronous JS, thak you!

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      You're welcome, Fabio! This is a really tricky concept to get down, so good work! 😄

  • @Talel_kraiem
    @Talel_kraiem ปีที่แล้ว +6

    I'm in love with this series 👏

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Thanks Talel! 😊 It's awesome to know that people appreciate this series and the content - the ultimate goal is to enable anyone to learn this inside and out for free from scratch!

  • @lauraogbechie2263
    @lauraogbechie2263 6 หลายเดือนก่อน

    I really appreciate the way you teach. Everything is explained as basic as possible. Thank you.

  • @kepdani
    @kepdani ปีที่แล้ว +2

    very nice video as always.
    I think I discovered a mistake in the presentation
    In the Rejected Promises part, the comment says "Here's your ice cream!", but in reality it's "Sorry, we're out of ice cream!".
    Anyway very good content. I'm bingewatching all of them
    I wonder why at 47:31 the IDE not fading out the reject, since based on this state of the code, it wouldn't run ever, and usually it does fade out code, that'll never run.

  • @OXIDE777-is6gs
    @OXIDE777-is6gs ปีที่แล้ว +2

    Awesome and funny examples :))

  • @parnasmi
    @parnasmi ปีที่แล้ว +1

    Good explanation on javascript promises! Thank you very. I will continue watching your other videos.

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Thanks Ilhom - and you’re very welcome! It was fun talking about ice cream and promises, haha! In all seriousness, I’m glad the analogy came through nicely 😄

  • @kaafi8921
    @kaafi8921 ปีที่แล้ว +3

    Your explanation and the way you make exercises about the concept is really amazing
    Create a tiktok videos of this content so we can get more people follow you

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Thanks! I’ll try some of the other platforms after I get this series done 😊

  • @TheHarist28
    @TheHarist28 5 หลายเดือนก่อน

    You are amasing , Thank you

  • @mushroom6538
    @mushroom6538 ปีที่แล้ว +1

    Whoa super detailed I got all the answers. great work and entertaining. And the drawings were great

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Thanks Mushroom! I’m glad someone appreciates my drawings, haha! 😆

  • @GanishiRanaweera-ip3uo
    @GanishiRanaweera-ip3uo 8 หลายเดือนก่อน +1

    Great!

  • @itsokthen
    @itsokthen ปีที่แล้ว +1

    These are really great, you started posting at the perfect time for me 😂

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +2

      Thanks! I’m glad to hear they are useful 😊 Let me know if you have any suggestions too!

  • @kinrev6719
    @kinrev6719 ปีที่แล้ว +2

    Thanks, GOD Nader for explaining the concept of the promises easily and neatly with the help of the diagrams. My favorite ice cream flavor is "Butterscotch", what's yours?

  • @user-lf1ym3xt9p
    @user-lf1ym3xt9p ปีที่แล้ว +1

    Great content..Keep up the good job🎉

  • @MateoEstudiante
    @MateoEstudiante 11 หลายเดือนก่อน +1

    Thanks :)

  • @jeremiahabiola994
    @jeremiahabiola994 ปีที่แล้ว +1

    Nice video man. Kudos. Keep em coming

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Thanks Jeremiah! Lots more coming 😊

    • @jeremiahabiola994
      @jeremiahabiola994 ปีที่แล้ว

      @@TechWithNader You are the best

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Hey Jeremiah, just letting you know I got the Discord server up and running if you're interested in joining: discord.gg/Qkc62kpsKr

  • @aquibjaved3911
    @aquibjaved3911 ปีที่แล้ว +1

    Good stuff, here’s a sub!

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Thanks Aquib! Glad you’re enjoying the videos! 😄

  • @EliHacıyev-p7v
    @EliHacıyev-p7v 3 หลายเดือนก่อน

    Thanks

  • @sebastianbazavan5320
    @sebastianbazavan5320 9 หลายเดือนก่อน

    Hello Nader, could you please tell us what theme do you use? It's very nice!

  • @oneofone_1333
    @oneofone_1333 ปีที่แล้ว +1

    Hey Nader
    Been watching your videos the last couple days, you helped me alot🙋‍♂️. do you offer 1to1 sessions?
    Love from Switzerland

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Hey there, glad you are liking these and thank you! 😊 For now I’m focused on making this content freely available to everyone on top of my other work haha. Feel free to join us on Discord though where I’m always online and so are several others in the community at various stages in the industry: discord.gg/Qkc62kpsKr

  • @zigzagcomedy5470
    @zigzagcomedy5470 5 วันที่ผ่านมา

    so tricky rejection is not working after commenting out the resolved value

  • @wjm915x
    @wjm915x 4 หลายเดือนก่อน

    Really well done. Thank you!

  • @chrismertz1185
    @chrismertz1185 ปีที่แล้ว

    I set up node.js on my computer, but I'm wondering how you got the terminal to look so nice in your IDE. Mine is stuck at the bottom of the screen and the text is all one color.

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Hey Chris! Hope you were able to figure this out. If not, I have a video on exactly how to do that on the channel timestamped here: th-cam.com/video/FPmgQsXMPqI/w-d-xo.html
      Hope that helps! As for the colour, the terminal colour changes are a bit more involved and it varies greatly depending on what operating system and terminal you're using. In my case I'm on a mac and using zsh where I have a configuration file setup to theme it to match my vscode theme 😊

  • @XanEli1
    @XanEli1 ปีที่แล้ว +1

    I'm wondering is the default that a promise can be pending forever or is it that if it's pending for a certain amount of time and doesn't get fulfilled it gets rejected?

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Great question! If you never resolve or reject, the promise will never "settle" and will be stuck in pending forever. You can try it like this:
      const forever = new Promise( () => {} );
      console.log(forever);
      You can .then and .catch on it (since it's a promise), but since it will never resolve or reject that code will never run. In practice you'll probably eventually have the promise resolve or reject even if it takes like 30s or so :)

    • @XanEli1
      @XanEli1 ปีที่แล้ว +1

      @@TechWithNader Thanks for responding so quickly! So, let me ask one step further. Do people add conditions for example that handle if a webpage were to not load after 1 minute, they would reject it?

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      @@XanEli1 Ooo, really good question! This is tricky to answer as there are several possible ways to deal with this and it mainly depends on what you want to happen. Here are some possibilities:
      - retry after X seconds with a new action/promise
      - if still failing after X retries maybe we give up
      - exponentially stagger the retries like 2, 4, 8 seconds etc then give up after some X amount of time
      - … several others and many that are less general 😄
      Hopefully that gets the wheels spinning! We’ll see some of these strategies when we work with APIs and fetch real data 🤓

    • @XanEli1
      @XanEli1 ปีที่แล้ว +1

      @@TechWithNader Oh I see, so it's up to the developers what best suits the given request and it's potential bugs to do with pending :D thanks!

  • @arturaghasafyants316
    @arturaghasafyants316 ปีที่แล้ว +1

  • @bulentgercek
    @bulentgercek ปีที่แล้ว

    Your effort in explaining the Promise concept is commendable. However, the setTimeout example in the input has nothing to do with the Promise. It's usually explained with this function, but it's completely misleading. In the Promise Constructor Code section, it is only the setTimout function that allows writing "Hello?" and "Hello my friend" respectively. All Promise does there is call the Executor function given in the process of instantiating by constructor.

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +1

      Hey Bulent! Thanks for the comment - yes you're right the constructor takes the executor and that part of the vid specifically wasn't really "using" the promise at all 😃 The approach here was meant to show the build-up to the actual use of the resolve and reject function calls that came next to change the promise state one step at a time 😊

  • @KRAKENBACK..
    @KRAKENBACK.. ปีที่แล้ว

    If you can chain promises with returning "yo" are you only able to chain fulfilled promises with .then or are you also able to chain rejected promises with .catch?

    • @KRAKENBACK..
      @KRAKENBACK.. ปีที่แล้ว

      and on those other chained promises are you able to add the delay time to those promises too or is the delay only on the resolve/reject new Promise function?

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      Good questions! Once a promise is rejected, it will look for the .catch. In there technically you can return another promise in the catch that you can .then on but it gets quite confusing quite fast at that point 😃
      Also, each new promise can have it's own delay and time 😊

    • @septembersaii2364
      @septembersaii2364 ปีที่แล้ว +1

      Would we have to use a set time mount function to add the delay to the chained promises?

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว

      @@septembersaii2364 Yup, for this this is our only method to artificially delay things haha. Later it will be things like “fetch something from a remote server” which takes some time and we can do that in a chain or as the first promise etc. Hope that helps! 😊

  • @TheZayzoo
    @TheZayzoo ปีที่แล้ว

    Do you have a video on closure?

    • @TechWithNader
      @TechWithNader  ปีที่แล้ว +2

      Great question! Not yet but that’s one of my favourite topics and will be a future video 😄
      Once we see scoping issues come up more it will help closure make more sense too.

    • @TheZayzoo
      @TheZayzoo ปีที่แล้ว +1

      @@TechWithNader thanks! Can't wait to see it.

    • @644sixfortyfour4
      @644sixfortyfour4 ปีที่แล้ว +1

      Yes please, I may understand it if you explain it. 😬