Javascript Tutorial – 13 – For Loop




Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Original source


23 responses to “Javascript Tutorial – 13 – For Loop”

  1. One question. Why do we have to declare the variable i=0 ? What part does that play in the for loop? The (i=0) part of the for loop is already telling js were to begin the loop so why do we still need to declare a variable? Also the loop still works fine without declaring a variable? Thanks

  2. xXxBoltxXx, an easy way to write a string (e.g. Potato) ten times is with a "while loop". Declare "i" as 0. While "i" is less than 10, document write "potato", and on next line… i++

  3. Can someone please help me? I don't know how to make JavaScript print out a word (string?) multiple times. For exapmple, to print out "potato" ten times. How do I do that with the 'for'?

  4. Your are awesome man!! You have a really good way of breaking things down. I submitted to your channel months ago and you have helped me out more than you can imagine. Thank you so so much!

  5. If you want, you can just use the built in Math object…

    Javascript has a built in pow(args1, args2) method…

    But if you want to just use the power of an integer manual for best programming practices, let me know…

  6. guys! i need help im writing a program for practice that does the function of ! on your calc (for those who don't know if you hit !5 it will do 5*4*3*2*1) anyways the way im doing it is that it runs a for loop that subtracts 1 from original number each time it runs until it hits zero. inside the loop i have total = total*number. this works fine and the total adds up. but i want to use the variable total outside of the loop but it doesnt recognize it as a variable…

Leave a Reply