Promises - Javascript In Depth

Поділитися
Вставка
  • Опубліковано 22 січ 2025

КОМЕНТАРІ • 70

  • @emacsultron6212
    @emacsultron6212 Рік тому +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  Рік тому +2

      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 7 місяців тому

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

  • @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 UA-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! 🥳

  • @properwaffles
    @properwaffles 2 роки тому +7

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

    • @TechWithNader
      @TechWithNader  2 роки тому +1

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

  • @serhatbalk5202
    @serhatbalk5202 3 місяці тому

    That is a through and through explanation really. Thanks a lot for taking the time.

  • @644sixfortyfour4
    @644sixfortyfour4 2 роки тому +3

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

    • @TechWithNader
      @TechWithNader  2 роки тому

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

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

  • @simplyskandi5973
    @simplyskandi5973 2 роки тому +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  2 роки тому +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 2 роки тому

      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  2 роки тому +1

      @@simplyskandi5973 Will do!

  • @Talel_kraiem
    @Talel_kraiem 2 роки тому +6

    I'm in love with this series 👏

    • @TechWithNader
      @TechWithNader  2 роки тому +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 10 місяців тому

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

  • @fabioescobar5463
    @fabioescobar5463 2 роки тому +3

    Finally I kinda understand asynchronous JS, thak you!

    • @TechWithNader
      @TechWithNader  2 роки тому

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

  • @GanishiRanaweera-ip3uo
    @GanishiRanaweera-ip3uo Рік тому +1

    Great!

  • @OXIDE777-is6gs
    @OXIDE777-is6gs Рік тому +2

    Awesome and funny examples :))

  • @parnasmi
    @parnasmi 2 роки тому +1

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

    • @TechWithNader
      @TechWithNader  2 роки тому +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 😄

  • @mushroom6538
    @mushroom6538 2 роки тому +1

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

    • @TechWithNader
      @TechWithNader  2 роки тому +1

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

  • @AppetitoLtd
    @AppetitoLtd Рік тому +1

    Great content..Keep up the good job🎉

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

  • @itsokthen
    @itsokthen 2 роки тому +1

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

    • @TechWithNader
      @TechWithNader  2 роки тому +2

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

  • @aarifhannan4429
    @aarifhannan4429 Місяць тому

    GOAT🐐

  • @jeremiahabiola994
    @jeremiahabiola994 2 роки тому +1

    Nice video man. Kudos. Keep em coming

    • @TechWithNader
      @TechWithNader  2 роки тому

      Thanks Jeremiah! Lots more coming 😊

    • @jeremiahabiola994
      @jeremiahabiola994 2 роки тому

      @@TechWithNader You are the best

    • @TechWithNader
      @TechWithNader  2 роки тому

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

  • @TheHarist28
    @TheHarist28 9 місяців тому

    You are amasing , Thank you

  • @wjm915x
    @wjm915x 8 місяців тому

    Really well done. Thank you!

  • @aquibjaved3911
    @aquibjaved3911 2 роки тому +1

    Good stuff, here’s a sub!

    • @TechWithNader
      @TechWithNader  2 роки тому

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

  • @arturaghasafyants316
    @arturaghasafyants316 Рік тому +1

  • @sebastianbazavan5320
    @sebastianbazavan5320 Рік тому

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

  • @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: ua-cam.com/video/FPmgQsXMPqI/v-deo.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 😊

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

  • @XanEli1
    @XanEli1 2 роки тому +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  2 роки тому +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 2 роки тому +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  2 роки тому +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 2 роки тому +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!

  • @zigzagcomedy5470
    @zigzagcomedy5470 4 місяці тому

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

  • @KRAKENBACK..
    @KRAKENBACK.. 2 роки тому

    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.. 2 роки тому

      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  2 роки тому

      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 2 роки тому +1

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

    • @TechWithNader
      @TechWithNader  2 роки тому

      @@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 2 роки тому

    Do you have a video on closure?

    • @TechWithNader
      @TechWithNader  2 роки тому +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 2 роки тому +1

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

    • @644sixfortyfour4
      @644sixfortyfour4 2 роки тому +1

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

  • @oneofone_1333
    @oneofone_1333 2 роки тому +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  2 роки тому +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

  • @MateoEstudiante
    @MateoEstudiante Рік тому +1

    Thanks :)

  • @EliHacıyev-p7v
    @EliHacıyev-p7v 7 місяців тому

    Thanks

  • @bulentgercek
    @bulentgercek 2 роки тому

    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  2 роки тому +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 😊