This is how I recommend you learn Recursion in Javascript

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

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

  • @JJTrades_X
    @JJTrades_X 2 года назад +25

    I love that you used the debugger. It’s such a powerful yet typically underutilized tool that we have at our disposal.

    • @Steel0079
      @Steel0079 2 года назад +2

      console.log(debugger)

  • @Kay8B
    @Kay8B 2 года назад +27

    Can I please request you use dark mode on Excalidraw, the contrast from your editor to the excalidraw hurt my eyes lol

  • @twentyhate
    @twentyhate 2 года назад +1

    I just want to thank you for your videos that I watch from time to time. I'm kind of "specialized" in Laravel but I like the fact that you explain very well, and that it can apply to any language.

  • @chenph6904
    @chenph6904 2 года назад

    First attempt to learn resursion. Your exaplanation is clean and clear. It must be helping a lot for a deeper study of recusion!

  • @gargantooga
    @gargantooga Год назад

    Thanks a lot, it's starting to make sense now. It's actually just a loop written differently when you think about it

  • @Sijo2
    @Sijo2 10 месяцев назад +1

    Thank you for your examples and explanations

  • @MrZeroowner
    @MrZeroowner 2 года назад

    Hey, man. That was awesome. I loved how simple and yet how deeply this video was.

  • @petermckeever2360
    @petermckeever2360 2 года назад +1

    Nice work, Cody. Tree structure definitely a good way to explain

  • @CottidaeSEA
    @CottidaeSEA 2 года назад +5

    I rarely find recursion useful outside of traversing trees, in which case it's a great approach. Loop through objects, if it has children (or a parent if traversing in that direction) then you just keep traversing until you find what you want, or until you achieve the desired result.
    I also use recursion for some maze algorithms I made, but those aren't too dissimilar to trees. It's a node based system at the very least, where each node has siblings.

    • @KyselPoints
      @KyselPoints 2 года назад

      I was unable to see contents of stack in chrome browser, can you help?

    • @CottidaeSEA
      @CottidaeSEA 2 года назад

      @@KyselPoints You'll probably find a good answer on StackOverflow, but sure, I might be able to help. What is it that you need to do? If you're talking about the call stack, if you press F12 and click the "Sources" tab you'll see it if you use debugger.

  • @MohammadAbrar-tx3fc
    @MohammadAbrar-tx3fc Год назад

    This really helped me learn

  • @k3tna
    @k3tna 2 года назад

    Great explanation, especially if you knew it but need a refresher

  • @lakshmitech4702
    @lakshmitech4702 2 года назад

    Your channel is 💎 to me.

  • @Ptbcpr
    @Ptbcpr 2 года назад +2

    im still a little bit confused. how does the function know to add all of the results of the recursive function up to create the result when its not state in the function at any point ?

    • @Birandoo
      @Birandoo 5 месяцев назад

      I don't get it either

  • @michaelharrington5860
    @michaelharrington5860 Год назад

    Tower of Hanoi is the real ball buster

  • @stephanykleen
    @stephanykleen Год назад

    any way you could do a video with that last permutation exercise? that's exactly what I am looking to learn.

  • @ikai2
    @ikai2 2 года назад

    Great video, please do more Vanilla Javascript videos. you're a great teacher.

  • @dws98
    @dws98 2 года назад

    finally, I understand it. thank you bro XD

  • @weiwei2694-q2h
    @weiwei2694-q2h Год назад

    Good Tutorial

  • @KyselPoints
    @KyselPoints 2 года назад

    I was unable to see contents of call stack in chrome browser, can you help? I followed your steps, still it did not work.

    • @WebDevCody
      @WebDevCody  2 года назад

      It should be there if you have a debugger stopped in a function somewhwre

  • @butwhothehellknows
    @butwhothehellknows 2 года назад

    Good job love ❤️

  • @bartoszwierzbicki5994
    @bartoszwierzbicki5994 2 года назад +1

    i get why fib 2 + fib 1 is fib 3, but i don't get why fib 3 + fib 2 is fib 4 :P. Can some one explain me this little detail?

    • @sontredis2579
      @sontredis2579 Год назад

      I believe it’s asking for the answers of fib(3) and fib(2) and adding them together to get fib(4) which is 3. Fib(2) and fib(3) is 2+1

  • @FrostTyler
    @FrostTyler Год назад

    I understand the concept of recursion perfectly, but I have no idea how to implement it. It's so mindbending trying to figure out what each step is accomplishing in the recursive body, and it just makes me want to rip my hair out.

  • @Nil-js4bf
    @Nil-js4bf 2 года назад

    I've been doing a few challenges from the "type-challenges" repo on github every day (treating it like a daily wordle puzzle) and it's forced me to get comfortable at recursion. That said, the lack of ability to debug a typescript function isn't great for learning. Also the challenges on that repo could be arranged in a better order. Some of its early stuff isn't exactly "easy" and some require really weird tricks which are nice to learn but can result in you wasting a lot of time if you try to do it yourself without looking at the solution.

  • @MrEnsiferum77
    @MrEnsiferum77 2 года назад

    Or u can use reduce function and using it as tail recursion.

  • @kenosabi
    @kenosabi 2 года назад

    I feel like this took a confusing topic and somehow managed to make it more confusing.

  • @mouhamaddiop1144
    @mouhamaddiop1144 2 года назад

    Vous aviez raison de dire que le factoriel peut être un cas d'utilisation de la récursivité.

  • @Segev031
    @Segev031 2 года назад

    The first element in Fibonacci series is 0!!!
    Great tutorial tho

  • @Afreshio
    @Afreshio 2 года назад +1

    it was amazing until the fibonacci example where it felt a bit convoluted and it was kinda complicated to follow the callback stack and the explanation. just my $0.02

    • @WebDevCody
      @WebDevCody  2 года назад

      I’ll try better next time

    • @KyselPoints
      @KyselPoints 2 года назад

      I too did not understand the call stack thing. It simply did not work in my chrome browser. Can you help?

  • @zaklettrezvenik
    @zaklettrezvenik 7 месяцев назад

    if this guy actually spends time to organize his explanations, he would be the best, no doubt! thanks, but in many points of the vid, you literally distracted me by making some mistakes, that were just caused by the fact that you explain on LIVE, or idk. but yeah, take that into consideration :) thank uuu for the explanations tho !!