• Thursday , 4 June 2020

JavaScript Tutorial For Beginners #18 – Break & Continue

Code Canyon

Break and Continue are two reserved keywords in JavaScript that help us when trying to ‘get out’ of a loop, and we’ll cover both in this tutorial.

Break, as the name suggests, breaks out of a loop at any given point, and Continue just tells the loop to ‘skip’ this particular iteration and carries on with the next one.

As always, if you have any questions, ask away :).

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

========== JavaScript for Beginners Playlist ==========

========== CSS for Beginners Playlist ==========

========== HTML for Beginners Playlist ==========

========== The Net Ninja ============

For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk

========== Social Links ==========

Twitter – @TheNetNinja – https://twitter.com/thenetninjauk

Original source

3d Ocean

Related Posts


  1. FlicksCode
    July 14, 2019 at 02:10

    Great tut my phone blurs every youtube video which sucks.

  2. sidfor911truth
    July 14, 2019 at 02:10

    Sound effects are great! Great tutorial, thx for posting!

  3. Hax Guru
    July 14, 2019 at 02:10

    You should make these courses for UDEMY

  4. ahmad khan niazi
    July 14, 2019 at 02:10

    Listening to that "WAAHHH" every single time without forwarding the video xD
    Great job man, you're da MVP!

  5. Arthur Burgan
    July 14, 2019 at 02:10

    I used continue in my loop and Airbnb eslint told me I'm not allowed to use it. Went on the Internet and read that it's bad for readability of your code and you shouldn't use it.
    How would you replace it? Is there a trick that doesn't make your code less readable and skips one iteration or should you write your code in a totally different way from the start with this in mind to omit "continue" usage?

  6. Jack Bennett
    July 14, 2019 at 02:10

    fantastic help, got my head around it seeing it rather than reading it! Cheers bro

  7. Ярослав Ефремов
    July 14, 2019 at 02:10

    Awesome content👍🇷🇺🇺🇸🤝

  8. Crypto Oten
    July 14, 2019 at 02:10

    Ivan brought me here. Thanks for sharing your video it's very helpful.

  9. theGoldenboy111111
    July 14, 2019 at 02:10

    I need some help in building break and continue javascript
    I want to write a code where there is like 5 switch toggles
    If toggle1 is ON, audio1 will be played, then continue to toggle2
    if toggle2 is OFF, break and skip to toggle3
    if toggle3 is ON, audio3 will be played

    until toggle5
    How can i write such code, please help

  10. NGAN 'Ann' NGUYEN
    July 14, 2019 at 02:10

    I love your channel. Thanks you!

  11. Mackel Dune
    July 14, 2019 at 02:10

    Ivan sent me.

  12. MAWA
    July 14, 2019 at 02:10

    Please stop the extra loud music. Otherwise these are very good lessons

  13. Nelson Ongiti
    July 14, 2019 at 02:10

    Hi what if i had 9 links and i wanted the first 3 to be green and the next 3 links to be blue and the last to be yellow but alternate when links are added. how can i achive this Thanks sir

  14. AniZion
    July 14, 2019 at 02:10

    where can i get these codes
    my console doesnt work welp

  15. Marketing RS&I
    July 14, 2019 at 02:10

    Such a simple yet highly satisfying video intro

  16. Thomas
    July 14, 2019 at 02:10

    Brushing up on JS really fast and I never actually understood this until now. Thanks ninja

  17. mogalana vats
    July 14, 2019 at 02:10

    It's easy to understand all these Javascript rules but hard to understand the practical use of all these codes in web development. it would be so kind of you if you explain the actual use of these codes at the same time.

  18. Ben Lim
    July 14, 2019 at 02:10

    If anyone is still confused by what "continue" does, copy and execute this code in console and it will be clearer.

    var myLoop = document.getElementsByTagName("p");

    for (i = 1; i <= myLoop.length; i++) {

    if (i === 5 || i === 3) {
    console.log("Restart loop when equal " + i);
    console.log("this is number " + i);

    if(i === 7) {
    console.log("loop ended successfully");

  19. Iranian Mapper
    July 14, 2019 at 02:10

    Where are you programming your code?

  20. Tiago Almeida
    July 14, 2019 at 02:10

    If we use continue, does it keep endlessly looping too, unless there is break?

  21. ieif
    July 14, 2019 at 02:10

    Great videos! Thanks for posting!

  22. YoungDo Choi
    July 14, 2019 at 02:10

    Hey mate, quick question for "while, for, break & continue" – can you give an example on where can I possibly use this codes on a certain project? I.e. how or why would I use this when creating a website or something else. JS is daunting seriously. Lol.

Leave A Comment

You must be logged in to post a comment.