• Friday , 5 June 2020

JavaScript Tutorial For Beginners #17 – For Loops

Code Canyon



An easier way to iterate through a loop is via the for loop, which we’ll talk about in this JavaScript tutorial. A for loop does exactly the same thing as a while loop, but it has the advantage of organizing it’s components more locally and neater.

As always, if you have any questions, fire ahead with them below :).

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

22 Comments

  1. Seán Earnest
    April 11, 2019 at 04:44

    What would be a typical usage case where a "for" loop would be preferable to using a "while" loop, other than to reduce clutter? Thanks again for the great content!

  2. Pablo Biedma
    April 11, 2019 at 04:44

    everything's better explained in british accent

  3. Daria
    April 11, 2019 at 04:44

    Very helpful – thanks!!

  4. Crypto Oten
    April 11, 2019 at 04:44

    Ivan brought me here.

  5. Axodus
    April 11, 2019 at 04:44

    It didn't work for me, And I don't know why.

  6. Fun With Benefits
    April 11, 2019 at 04:44

    it's very short explain it's not good for professional

  7. Mackel Dune
    April 11, 2019 at 04:44

    Ivan brought me here.

  8. Arthur Cachero
    April 11, 2019 at 04:44

    Can you add another video showing different problems utilizing the for loop?

  9. Lon W.
    April 11, 2019 at 04:44

    I gave each element an id assignment because the console read an error for getElementByTagname The console logged 5 links and printed out.

  10. Prashant Panwar
    April 11, 2019 at 04:44

    Why we right '+ i' in consol.log?
    Couldn't we just say 'i'?

  11. Semantron
    April 11, 2019 at 04:44

    I need help. Do you know how to turn off errors that are showing in brackets (probably new version) in js files on some codes which are absolutely correct. I just done the same code that is in the videos but those red circle errors keep showing on some codes.

  12. Devo Overkill
    April 11, 2019 at 04:44

    when a C programmer see this XD::
    for(;;){console.log("I hate web programming !");}

  13. Hobby electronics21
    April 11, 2019 at 04:44

    error are appearing please help!

  14. Rooke RON
    April 11, 2019 at 04:44

    When I put '"links.length" nothing shows up on my screen, but the moment I change it into a number; the loops show up. lol?

  15. April B
    April 11, 2019 at 04:44

    your videos are so easy to understand. Can you please do an example of how to create the game hangman using JS? Or other games?

  16. Shawn Zain
    April 11, 2019 at 04:44

    I have a question that has been bugging me for some time now. If I wanted to use the variable i inside the loop, to let's say push an 'input to the alert' into an array of objects, how would I go about that?

  17. David Mchale
    April 11, 2019 at 04:44

    Great tutorials lads. Nothing better than showing 'actual examples' like looping through links, then just going over the fundamentals.

  18. Raphael boateng-amponsah
    April 11, 2019 at 04:44

    Thank you so much for this I really appreciate the time and effort you put into these vids.

  19. Marilyn Hoelscher
    April 11, 2019 at 04:44

    I am using brackets and typed in the code, verbatim, with the following errors  JSLint (6)3'i' was used before it was defined.for (i = 1; i < links.length; i++) {3Unexpected '++'.for (i = 1; i < links.length; i++) {3Unexpected '(space)'.for (i = 1; i < links.length; i++) {5'console' was used before it was defined.console.log("this is link number" + i);9Expected 'document' at column 1, not column 3.document.write("all liks are looped");Help?

  20. Mikhail Bisserov
    April 11, 2019 at 04:44

    You do need 'var' keyword for 'for' loop variable, otherwise you create a global variable which remains while page lives. Let alone cases when you recursively call a function containing 'for' loop. And if you use ECMA6 then 'let' variable is even better for 'for' loop.

  21. sshah93
    April 11, 2019 at 04:44

    hi there, great videos, really learning alot from your playlist of this series. Just a quick question, you dont seem to be using var to declare the new variables within the for loops, the code still seems to work, so just wanted to confirm, is var not required within the for loop or is it good practice to use it. e.g. you did:

    – for (age = 5; age < 10; age++) however should i be doing:
    – for (var age = 5; age < 10; age++) instead.

    Thanks again.

  22. Al M
    April 11, 2019 at 04:44

    thank you for all the info man… btw what type of text editor is that? look amazing!

Leave A Comment

You must be logged in to post a comment.