JavaScript Loops

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

КОМЕНТАРІ • 40

  • @Robb2430
    @Robb2430 4 роки тому +10

    You are a very good teacher. Slow and clear. Can't stand these showoff UA-camr's racing through explanations like they are talking to a bunch of seasoned programmers. Well done and keep it up!!

    • @CodingJourney
      @CodingJourney  4 роки тому +1

      Heh thanks for the lovely comment 🙂 I don't think they are showing off! Problem with detailed explanation is that it results in longer videos... But anyway, very glad you liked this video! All the best, keep coding 😉

  • @Akira-uj2un
    @Akira-uj2un 2 роки тому +2

    you have so much talent teaching! thank you!

  • @robertholtz
    @robertholtz 3 роки тому +4

    Very nice precise and informative instruction.

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

    The most complete and informative tutorial on Loops. Thank you!

    • @CodingJourney
      @CodingJourney  3 роки тому +1

      Oh thank you for the lovely comment 🙂 Glad you liked it!! 💙

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

    Wow man what a video bro, jam packed with knowledge.
    This video was epic, very informative. This is the first time I thoroughly understood about all the loops in JavaScript. This definitely helped in my understanding of the JavaScript loops.
    Thanks so much.
    Very much appreciated. I will definitely be coming back for more javascript and other related content. Respect!

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

      Amazing! So glad you found this video helpful. Thank you for the lovely comment! All the best 💙

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

    Excellent Tutorial!!!

    • @CodingJourney
      @CodingJourney  3 роки тому

      Thanks mate! Glad you liked it 💙💙

  • @yogadiary8584
    @yogadiary8584 4 роки тому +3

    Very good teaching, slowly and well explained. Thank you so much!

    • @CodingJourney
      @CodingJourney  4 роки тому

      Amazing! Very glad to hear this was helpful 🙂 Thank you for the lovely comment!! 🙂

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

    Well Explained ! Thank you for your hardwork!

    • @CodingJourney
      @CodingJourney  3 роки тому

      My pleasure 🙂 Glad you liked it! 💙

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

    Thank you very much, it was a big help

  • @kasperkat2004
    @kasperkat2004 4 роки тому +4

    Thank you for this amazing professional presentation. It is the best and exactly what I need.

    • @CodingJourney
      @CodingJourney  4 роки тому

      Oh thank you for the nice words 🙂 Very glad you liked it!!

  • @backda
    @backda 5 років тому +1

    It seems to have studied this material, but still learned new cases for myself after watching this video. Thank you for your efforts.

    • @CodingJourney
      @CodingJourney  5 років тому

      Thanks man! Very happy to hear that you found this useful!!

  • @rolandohaynes9093
    @rolandohaynes9093 5 років тому +3

    This is brilliant! THANKS

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

    Nice, nice! Thanks :)

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

    I’ve often been told that for...of loops are slower than for loops but, when processing an array of all elements starting with the first element and ending with the last, I have always preferred the clean syntax of for...of. I never bothered to actually speed test each loop type. In fact, by casual observation, I never saw any discernible difference. I even contemplated the possibility that the assertion that for...of loops were slower might be a made up notion or that the difference is so negligible that the distinction was purely academic. Your speed tests here are truly eye opening for me. So much so that I am compelled to revisit some existing code already in production for a long time now in order to improve performance. This also affirms my theory that less code is not necessarily optimal code. A great developer considers runtime execution as a key factor to inform their design decisions. Thank you. I’m an instant fan of your excellent work. Subscribed!

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

      Oh thank you for the nice words! Yeap speed difference between for and for...of loops is not a myth 🙂 but at the same time in many cases (most cases I would argue, unless there is a huge number of iterations) it is insignificant. Agree, less is not necessarily more when it comes to optimal code 🙂 not just when it comes to execution time optimization but also due to maintainability issues...gone are the days when I tried to come up with "clever" one-liner solutions 🙂 Thanks again, keep coding and welcome aboard 😉🙂

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

      @@CodingJourney Thanks for the thoughtful reply. It's the last speed test that shook me up. The delay on the for...of was notably slow. I have a block of code that inspects all tags on an HTML page and can be used by other developers. There is technically no upper limit to how many elements there might be in a single page to iterate through. In production, I've never seen it take much time at all. In fact, it seems instantaneous. But I think I will have greater peace of mind knowing I optimized for performance having seen real evidence for the first time of the speed differences. By the way, it might interest you to know, I console-timed my actual code to observe the difference since watching your video and there is definitely a performance leap with a standard for loop. I must say... while I now gladly accept that for...of loops actually are slower, I still don't quite understand WHY. I always thought, if anything, for...of loops should be faster. They don't take any input on the starting number or the increment interval and they don't need to update a variable to report where the pointer is within the loop. The only heavy lifting it does is sizing up the array but that is exposed by .length which 99% of people set their old school for loops to as the ending number. So my next mystery on this subject is why this is. But in any case, you taught me something new and unexpected and, for that, I salute you.

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

      That's a good question 🙂 Just observing the results here and not getting into the cause 🙂 My guess would be that since "for...of" loop is syntactic sugar for the "for" loop, there is some extra overhead for the "for...of" loop (what you are describing is happening under the hood). But I'm just guessing here, more research would be required for a definite answer 🙂 Thank you for your comments and input!!

    • @robertholtz
      @robertholtz 3 роки тому +3

      @@CodingJourney “Syntactic Sugar” 😎 Well said, my friend. Clearly there is added overhead as the speed tests prove. This runs counter to my prior intuition on this but the data doesn’t lie. I hope there is someone out there who could explain to both of us why this is... or someone crazy enough to actually go under the hood to pick it apart and unravel the answer. Thanks back to you for the thoughtful responses. Thanks also for reminding me that no matter how many decades one has been coding, there is always much more still to learn. A good developer has a healthy comfort level with the unknown. The moment they believe they know everything there is to know, is the moment they stop growing in their craft. Cheers.

  • @James-dh6gt
    @James-dh6gt 5 років тому +1

    Beautiful! Thanks mate!!!

  • @Notwoke9171
    @Notwoke9171 5 років тому +1

    Very Helpful!!

  • @saidur_setu
    @saidur_setu 5 років тому +1

    Just brilliant!

  • @Mr3DLC
    @Mr3DLC 3 роки тому +1

    for(const [index, elem] of myArray.entries()) {
    If I were to omit the method, being .entries(), from this line, would the for...of loop still run properly?

    • @CodingJourney
      @CodingJourney  3 роки тому +1

      Hey mate! If, besides the array elements' values, you also want to access the indexes, then that's how you should do it (if you omit the .entries() method you won't be able to access the indexes). If you only want to access the values, then you don't need the .entries() method. In that case you only need: for(const elem of myArray) {...}

  • @JD-kf2ki
    @JD-kf2ki 3 роки тому

    Why my "OUTPUT" terminal doesn't log?

  • @ihuomaendaline3030
    @ihuomaendaline3030 3 роки тому

    Cool but not really clear

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

      Thanks! I've put many hours into this video, trying to make it as clear as possible...there is always room for improvement of course 🙂 what part did you find confusing?