What are JavaScript Generators and Iterators?

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 26

  • @andrew-burgess
    @andrew-burgess  Месяц назад +9

    By the way, would anyone be interested in a live Q&A? I'm thinking about doing one when we reach 25K subscribers. Lemme know!
    THANKS FOR WATCHING!

    • @obifortune
      @obifortune Месяц назад +1

      i would be interested!

  • @hyperprotagonist
    @hyperprotagonist Месяц назад +18

    The way you explain things, I feel it always clicks the first time. Watching your video should be valid experience on a CV 😂

  • @DEVDerr
    @DEVDerr Месяц назад +14

    Holy shit, probably first breakdown of an iterators that I deeply understood! Gj man!

  • @xeliqa3921
    @xeliqa3921 Месяц назад +3

    Amazing explanation, easy and clear to understand, especially since you started from ground zero and worked up

  • @tefkah
    @tefkah Месяц назад +1

    this is great! I've only been comfortable enough with iteratorss etc to be able to consume them, but never enough to actually know what I was doing and definitely not enough to implement them. now I get it, tysm!

  • @anthonylee1309
    @anthonylee1309 Месяц назад +5

    Thank you for the great vid!

  • @fagnersales532
    @fagnersales532 Месяц назад +1

    Amazing, understood everything you said now I'm excited to find ways to use that in my project.

  • @bjul
    @bjul Месяц назад +1

    Finally yield makes sense! Thanks a lot 🤝

  • @macr76
    @macr76 Месяц назад +1

    Great video, I like it. One little nice trick about iterable objects and generators - if you want to convert your object/class into iterable, implemented [Symbol.iterator] method can be generator function, which is far more convenient than writing simple iterable.

    • @andrew-burgess
      @andrew-burgess  Месяц назад

      Oh, that's a great tip, thanks for sharing!

  • @en818
    @en818 Месяц назад +1

    thanks! very well explained and super helpful!

  • @buscandolaverdad8295
    @buscandolaverdad8295 10 дней назад

    Really cool explanation. Thank you

  • @nickolaizein7465
    @nickolaizein7465 Месяц назад +1

    Very well! Really good. But when do you use generators in your projects? Any good examples of it ?

  • @gamingwolf3385
    @gamingwolf3385 Месяц назад +1

    This is really good , i like your explanation , but what about usecases of those generators , i was waiting for some projects/packages uses them

  • @quanminh8441
    @quanminh8441 Месяц назад +1

    I love this so much

  • @Luxcium
    @Luxcium Месяц назад

    i would love to been taught about how normal generators can yield promises and the benefit of of such exotic thing when compared to the more normal asyncGenerator that people use normally when they have promises

  • @sayeddileri3461
    @sayeddileri3461 Месяц назад

    Super helpful. Thanks!

  • @frstylol
    @frstylol Месяц назад

    You're THE G🔥🔥

  • @sanyamjain7058
    @sanyamjain7058 Месяц назад

    nice explanation and i would like know about "for await...of", async generator, async iterator and async iterable protocols, it confuses me alot..

    • @andrew-burgess
      @andrew-burgess  Месяц назад

      Thanks! I'm planning to talk about the async versions soon!

  • @adambickford8720
    @adambickford8720 Месяц назад

    This is why types are nice; you have them in js, you just can't express them. Instead, we reinvent them as 'protocols'.

  • @AK-vx4dy
    @AK-vx4dy Месяц назад

    I have a stupid question, is reversing value and done declaration change evalution order and solves problem with do/while loop ?

    • @andrew-burgess
      @andrew-burgess  Месяц назад

      Not a stupid question! I think you're right. But one thing I got wrong here is returning the final value with done:true. Really, the next result after the final value in the sequence should have value:undefined, done:true.

  • @coder_one
    @coder_one Месяц назад

    Great video. We learned what Generators and Iterators are and how to use them in the least useful case in life - writing a function that generates fibbonacci numbers. I completely do not understand why such materials are created....