Generators - Javascript In Depth

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

КОМЕНТАРІ • 19

  • @Kerwell
    @Kerwell 2 місяці тому +1

    it seems simple, yet open ended in complexity. very interesting and eager to do the exercises

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

    Priceless video, I didn't even know about this, thanks!

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

      You’re welcome! I was worried it would be too intense haha!

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

      It's a little more advanced than most of the other stuff covered so far, but it's not out of reach.

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

    I jumped back to this video as I really had no idea what generators are or where can they be useful. Going through this video alone, I can see myself using them as they can be really handy. Glad there are even more videos about generators , thank you very much Nader. 😁

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

      Awesome, nice work! I can’t wait to use them more practically as we build more complex projects as well as look at how they are used in Classes 😊

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

      @@TechWithNader Those will be videos I'll be looking forward to then. 😉

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

    It seems like generators are a very powerful way to pull values whenever specifically needed, and save on tons of memory.

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

      Yup exactly! It's tricky to use them for things other than iterators to start however it's important to be aware of the concept of 'lazy evaluation'. In fact, as you'll see later, async/await is actually based on this concept internally 😊

  • @vikaswakde-dj2dw
    @vikaswakde-dj2dw 11 місяців тому +1

    Congrat's on 10K

  • @ArfatKazi-h2z
    @ArfatKazi-h2z 2 місяці тому

    My brother Nader you are awesome 🥰🥰🥰😘😘😘

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

    Another question lol I'm back again rewatching and thought when we create the infinite loop for lazy evaluation and create our countergenerator = counter();
    couldn't you have multiple countergenerators(1,2,3 ect) that save on memory, since it's a object could you add more properties in this object to x amount of different objects, and depending on the objects they could represent different things. My main question is what type of objects/concepts can we create with this in real world settings because it seems like a very efficient way to produce values.

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

      Good question! In the real world this is used a lot to implement lazy evaluation code like something called the Observer pattern. It’s also used to make Iterators a lot.
      We actually explored only half of generators since you can also provide inputs to them so they are essentially no-directional pauseable functions. Also, concepts like async and await are based on them. For now just being aware of lazy evaluation and that they exist will be important as we move forward. 🤗

  • @senniagordinskaya4051
    @senniagordinskaya4051 6 місяців тому

    Thank you!

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

    👍

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

    👍🏽👍🏽👍🏽

  • @journeyofc6200
    @journeyofc6200 2 місяці тому

    I saw this is nodejs stream docs