JavaScript Loops Made Easy
VloĆŸit
- Äas pĆidĂĄn 19. 11. 2019
- đ Become A VS Code SuperHero Today: vsCodeHero.com
In this video, we'll learn about all of the different types of loops in JavaScript. Loops are a way of repeating things in JavaScript. We'll cover FOR, FOR..IN, FOR..OF, WHILE, DO..WHILE, and the high order array function forEach. I will do my best to make JavaScript loops simple and easy.
_____________________________________
đ Learn to CODE in just a FEW months here:
Treehouse Discount Code: treehouse.7eer.net/codeSTACKr
_____________________________________
đ ïž Tools I use:
đ Theme: marketplace.visualstudio.com/...
đ Font: STACKr Code (Exclusive to my VS Code Course - vsCodeHero.com)
đ SuperHero Extension Pack: marketplace.visualstudio.com/...
đą Deploy for FREE on Vercel: vercel.com/ambassadors/codest...
_____________________________________
đ Show support!
PayPal: paypal.me/codeSTACKr
_____________________________________
Watch Next:
Web Development - Beginners Roadmap (2020) - âą Web Developer Roadmap ...
Playlist: Web Development For Beginners - âą Web Development - Begi...
_____________________________________
Connect With Me:
Website: www.codestackr.com
Twitter: / codestackr
Instagram: / codestackr
Facebook: / codestackr
_____________________________________
** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.
#codeSTACKr #JavaScript #learntocode
Thanks for all of the support!!
Next up Learn Sass in 30 Minutes:
czcams.com/video/BDOzg4lXcSg/video.html
đ My Favorite Web Design Books đ
Web Design with HTML, CSS, JavaScript and jQuery Set by Jon Duckett (paid link)
amzn.to/2JaiCL8
At 6:18 you saved and it transformed "firstName": and "lastName": into variables, what addon does that? Seems very useful.
I can tell you watch Mosh tutorials
thanks so much. ive been struggling with loops for the past week and this really clear it up. ill share with with everyone in my group xD
This is the best tutorial channel I have ever seen. straight to the point with colourful examples. You have worked hard to make us these videos. Thank you so much for the work. Keep them up. we really need them.
Why can't everyone teach like this? This was so simple.
Thank you!
Bro, I love how you explained for loops. I just enrolled in your JavaScript course. Thanks for the coupon too. #respect
Iâve used for loops before in powershell but, you just simplified so much!
This was perfect! I fully understand now and can refer to this video when I inevitably forget.
thank you so much bro,i had a lot of problems to understand for of and for in loop but i finally got it because of you,thanks!
Great Explanation. I'm second year in college and so far this has been the best explanations i've recieved. Often times I find myself just doing things because stack overflow had suggested it lol. Nice to dig into things a little more.
Thanks!
Glad it was helpful!
Thank you so much!! Very clear and simple!
omg this guy is amazing. I just subscribed to his channel. I understood everything easily. keep up the great work. if I see this guy in person, I will give him a gift right away. love it
My beginner questions and problems when I first learned about loops:
* "How does the loop know what to loop?" (--> it's in the scope (= what's inside the curly brackets), silly)
* I had trouble understanding why the condition was "i < 'number of iterations' " in the for loop and not "i
Really helpful. The best Loops video I've found
Best video on loops I have found! Well put! :-)
Thank you now I understand them better!
I was having such a hard time understanding this Thank you!
thank you this helped me understand it a lot better
Thanks a lot, very clear explanation!
for...in loop felt more like foreign loop until this video. Thanks a heap!
Brilliantly explained, thank you so much!
Thanks for making it harder
I wish everyone explained as you do.
Thank you for the amazing explanation of the loops! now I understand them better! I really appreciate it. please keep it up! Can you please tell me what is the name of your theme?
Can you please do a practical tutorial on the MVC pattern? Not just theory but also in code.
Thanks dude, now I understand these loops! Subscribed :D
Awesome, thank you!
Thanks! I now understand for loops!
Great!
Hi CodeStackr, how do you get you vs code screen to show console? mine only has debug console. I have to refresh my html browser page but would like it rather inside the editor.
Great voice, clear explanations and great teaching. Thank you!
Whatâs your font text and theme in this video?
thank you for this.
THANK YOU
This is beautiful and well explained. thanks
This was a great video. Some people are born teachers. Thank you
thank you
Thx!
Thank you
Thank you!
You're welcome!
excellent and easy
very good. thank you
Wonderful explanation! ..Subscribed!
Awesome, thank you!
Thanks bro finally I understood loopsđ
Glad it helped
thankU
Thank you for this tutorial...very helpful
Youâre welcome đ
I guess the beginners are often confused about the "in" and "of"! But if you think like "in" like in a stack and "of" like belonging to someone, it might be easier, not sure!
Great explanation!
of
@@lycan2494 exactly
Thanks a lot!
You're welcome!
love this, keep it up!!
Thank you! Will do!
subscribed- thanks for the explanation!
Thanks for the sub! Glad to help đ
Maybe this is the best video I'd ever watched
I think i get the beginning part. The "i = 0" is the startup, the "i < 5" is the condition or the requirement to process and "i++" is the continuation process after the int starts. If a number passes 5 then it doesnt do anything....sound about right?
Can you use a for loop in a gallery with the 'next' button?
How did you add the console to Visual Code Studio?
When do we use each of this? I understand the logic but I dont know which loop to use in real situations
I just posted a long comment that touches on your point. If you wish to loop simply to repeat an instruction the same way through each iteration, use a conditional loop. If you wish to use your loop as a means to index through another object, element, or data structure, use a loop type with an increment value so you have precise control of the index pointer. Take comfort that there is overlap between use cases where one solution is equally effective as another. Ultimately, this will reflect your personal programming style. Hope that helps.
Saw your post on reddit, im learning javascript after learned HTML and CSS. Good video, helped me! Big thanks!
Thanks for your support!
Iâm understanding the concept a lot better, itâs just the syntax and where to place is where I get lost
So nice
nostalgic opening sound
Really amazing explanations
Glad it was helpful!
What's the difference between for in loop and for each loop?
Nice
How do you get VS Code to run JS with an output? I installed code runner, but it doesn't like it.
thanx, dude
No problem!
great explanation
Glad it was helpful!
1:29 - I suppose in the big picture itâs arbitrary, since the variable assigned to a loop construct can be just about anything. That said, in my 30 years programming in many languages, âiâ has always represented the increment value for the loop. Therefore âiâ more typically stands for âincrementâ not âindex.â Itâs clear that one can (and often does) use the increment value in a loop as an index so I can understand why youâve concluded that âiâ as a rule of thumb stands for âindexâ rather than âincrement.â But let my point out that, all loops increment but not all loops index. Your first example console.logging the word âLoopâ is a case in point. This again may seem arbitrary but if you really want to lay down the foundation of loop fundamentals as a universal concept, I think the distinction is important. Just my two-cents. I always enjoy your great videos.
The format of the one given in my textbook is a bit different...
They have given {statement block} after iteration). Please Explain the same
Quick question: " when added --continue- in the while statement, why did the console print 10 if the condition was < 10?" (min 8:50)
Take a look where he placed console.log(i); || During 9 it reads while (9 < 10) increment i by one to 10 and then console.log(10); will print 10
it was 9 during the conditional so it passed, but it got incremented before printing like @eunai said
So easy to subscribe when it's this good!
Great video!
Thanks for your support!
Lol
Thanks for this, helped a lot.
Why when I do this and use the Alert function it skipped the 1 increment...went from 0 2 456789...why skipped 1?
Thank you for tutorial! What is the difference though, between System.out.print(); and console.log(); ?
Two different languages. Java and JavaScript
@@codeSTACKr thank you for your reply !
How did you have a debugger on the right side like that for Visual Studio? I normally use chrome to check my codes.
It was the Chrome console.
@@codeSTACKr Why was it black? Is there an option to make your chrome console in dark mode?
@@MrNate858 it was incognito mode
I need your help with a project. How can we discuss it.
Nice Explanation!!
Thanks i will never see loops as my enemy againđ
đđđ
hey how does javascript knows john, marry ....... etc are names in the for of loop ????
names are treated as strings
Yes he puts them in string in the variable names so John, Mary, Bob etc are just strings
Why did we start the index on the outside of the loop?
Just a quick update (perhaps it's only me experiencing this)
When i type "for (name of names)" in the current version of VS Code ---> the first "name" in the bracket has a line through it and I believe this style of looping is deprecated.
Anyone else experiencing this?
Love u
How do you disable the code?
if I write "console.log" above the "IF statement" its count the loop from 0 to 9 and if I write it below its show numbers from 0 to 10
someone can explain why its happen?
#1
for (i = 0; i < 100; i++) {
if (i === 10) break;
console.log("Loop " + i);
}
#2
for (i = 0; i < 100; i++) {
console.log("Loop " + i);
if (i === 10) break;
}
Every time it loops it iterates i. In #1 you are breaking when i is 10, so it stops and doesn't not log. Opposite for #2.
@@codeSTACKr Thank you
Your videos are great...can you make videos on Angular....It would be a great help or you can refer me someone....Thanks!!!
Thank you! For Angular I would recommend looking at Traversy Media.
@@codeSTACKr Your recommendation is great...Thanks bro!!!
i feel like i've time-travelled 5 months back into time
Wot
Do you have online courses?
Is "i" equivalent to the algebraic variable "x?" Like "x = ... ?"
Why did the whole loop count up to 10 when placed after the continue? Shouldnât it have stopped at 9??
There is a mistake in the assumption of five in the loop. The loop does not stop before five, the loop stops after five iterations. The first iteration beginning at zero, added to the following four iterations, equals five. This is clearly displayed in the console to the right.
So it turns out, I wasn't born with a dumb brain, I was being taught wrong way. God damn it was so freaking easy. My man do you got udemy course on javascript.
Thanks, I'm working on a course as we speak đ
@@codeSTACKr well any idea by when it will be released? I'd really love to learn it from you. Today I bought Colt Steele's Javascript course, and it is going pretty good, but I like your teaching style more. Eagerly waiting mate. I've subscribed you, so anytime your course is out, please upload a video on CZcams letting us all know.
And hell yes you are amazing teacher.
Thank you! You will do great with Colt's course. It's a good one. Another I would recommend is Wes Bos'. I hope to have my course complete by June.
thank you, but what is 'i' referring to exactly?
You can replace "i" with any character(s), but the standard practice is to use "i" to stand for iterator. It's basically just a way to keep track of a count.
i don't realy understand when i should use {for in } or {for of}
We already know the basics of loops...but can you please go through real world practicals so that we can understand more
I need like actual visuals.
I am busy with Loops but it doesn't want to stick. Let me try again.
why does everyone explain loop in the global sense. It's when you put them into functions and you start adding 700 {} and separating the index from the condition, oh and you were supposed to put the increment after that - no you're supposed to put it down here after the body and oh, there's an error message because you used console.log and you were supposed to return.... blam! my head just exploded.
Could someone please explain loops INSIDE functions?
Ik I'm so effing confused jahaha
Here's part tip me up until I throw crazy amount time at reading and understanding lingo and symbols. Slowly with help good translators it click just at different times for different minds. Fredrik Christenson , Hussein Nasser will get you rockstar status
he forgot map()
I am a very beginner. I couldn't understand your explanation at all
This is just a black blank screen
it's definetally not for beginners
thank you