The nested array part makes me wanna dropkick a toddler.
@YourBeautyRefinedAracely4 жыл бұрын
LOL!!! this legit made me cackle. But I understand what u mean!
@EssLoco3 жыл бұрын
I'm learning JS atm and nested for loops threw me off terriably, still got to push on i suppose
@grant25723 жыл бұрын
I needed this laugh while going through the same emotions lmao
@EssLoco3 жыл бұрын
@@grant2572 i haven't laughed since learning about nested loops, unfortunately...
@grant25723 жыл бұрын
@@EssLoco - You on freecodecamp?
@oufcena50924 жыл бұрын
Loops are used to access arrays using the index of its elements. Nested arrays needs nested loops as a result. 1st loop to access the outer array & 2nd loop to access the inner one. var arr = [0, 2, [3, 2], 7]; arr[0] = 0; arr[1] = 2; arr[2] = [3, 2]; arr[2][0] = 3; arr[2][1] = 2; arr[3] = 7;
@godismyway7305 Жыл бұрын
Thank you so much!
@izaakchater91655 жыл бұрын
Thank you very much for this. I was struggling to get a good understanding of this section in Code Academy but you've broken it down in a way that's given me a lightbulb moment
@bikepackingeurope20853 жыл бұрын
me too!
@KOSHPARZ3 жыл бұрын
Coming from Codeacademy aswell haha One Year ago huh what's your progress now?
@godismyway7305 Жыл бұрын
@@KOSHPARZ What is n your progress brother?
@cinammondream Жыл бұрын
What a beautiful thing to say! "Use your code for good!" WOW!!!
@Mohammed-od4ju4 жыл бұрын
Beau is a LEGEND in the dev game!
@veetoutas6 жыл бұрын
Thank You for sharing the knowledge. I really like Your videos, because You touch the topic a little bit deeper than just very very basics. I really start to understand stuff because of You. Your tutorials are highly appreciated. Liked and subscribed, my man.
@kandysman865 жыл бұрын
It's been 11 months since this comment, how are you doing now?
@temzeks4 жыл бұрын
Yeh id wanna know too
@haycheC3 жыл бұрын
@@kandysman86 what about you? been 2 years?
@whyfoo2 жыл бұрын
@@haycheC how about you its been 1 year ??
@SmokeDemonKenpachi Жыл бұрын
@waifutrades what about you? It's been half a year???
@Sage162266 жыл бұрын
thanks for the easy explanation, just learning how to program, couldn't grasp the for loop until this video.
@temzeks4 жыл бұрын
Any advances?
@goldensleeves3 жыл бұрын
Great video! It's very confusing how i++ happens AFTER each loop but it's placed at the beginning. Your video helped me see that was true. Thank you
@TheHappyKamper3 жыл бұрын
yeah I think while loops are so much easier to understand visually. Using a while loop, the example in the video would look like this: while(i
@fabriciohlgn63972 жыл бұрын
Thanks Beau, I needed a break; to fix my for loop… many thanks 😊
@Paltibenlaish6 жыл бұрын
always forget this for loop. thanks for the explanation!!!!! keep doing !
@janosvegh25105 жыл бұрын
Very good explanation, real teacher value here.
@ciceroaraujo51834 жыл бұрын
Excellent professor
@nicolejsaunders6 жыл бұрын
Thank you so much! This one had my head spinning.
@Hellokittyenby6 жыл бұрын
I didn’t understand 😭💔
@alicenikuze2316 жыл бұрын
Im also struggling to understand but i get the idea.
@alejandrocano885 жыл бұрын
keep on practicing, but i guess by this time you should already know ;)
@temzeks4 жыл бұрын
Did you guys understand
@benjameerave43293 жыл бұрын
its just like while loops
@josh__f Жыл бұрын
Thanks, Beau!
@danielstoicamusic7 жыл бұрын
About the first example, why would you add an if statement which is totally opposite of the initial condition? Why not just say from the beginnin i
@joxim6977 жыл бұрын
From my point of view, he just used current example to explain how break works.
@ChrisTian-ox5nr4 жыл бұрын
Thank You great tutorial on loops.
@MrWardo20094 жыл бұрын
Thanks! Great explanation!
@ninastech777 Жыл бұрын
Thanks for explain!
@vmax9247 жыл бұрын
Thanks Beau, awesome tutorial! Just 1 question: I don't understand the output flow of 'console.log(arr[ i ] [ j ])'. I tried to output the log of 'console.log(arr[ j ])', the result was like : (2) [1, 2] (2) [3, 4] (2) [1, 2] (2) [3, 4] (2) [1, 2] (2) [3, 4] and also tried 'console.log(arr[ i ])', it was like: (2) [1, 2] (2) [1, 2] (2) [3, 4] (2) [3, 4] (2) [5, 6] (2) [5, 6] why does it always output 6 times? why on the first example, the loop didn't find the array [5,6]? Thanks for your great tutorial again!
@souravsuman19937 жыл бұрын
I first part arr[j] the value of j was never 2 that' is why the it doesn't print [5,6] The six times printing on console was because your for loop goes 3*2 times
@neenus6 жыл бұрын
Great explanation thank you ... can I just ask is that jsfiddle that you are using?? if yes how did you show the console?? I'm new to all of this and I'm trying to do this so I can test my javascript while learning but I can't figure out how to show the console ... so far I've been using the console in developer tools in Chrome
@neenus6 жыл бұрын
never mind I just noticed your link to codepen but thanks anyway! that works as well.
@DrBotnus4 жыл бұрын
console.log(Whatever you are logging in the console, for example calling a function and getting the outputs of it.);
@Urmomsstockings Жыл бұрын
I am confused just because I feel like the first for loop for variable i could be sufficient to display the whole array. Is there a reason there is a second for loop?
@garrettbaker23207 жыл бұрын
Does anyone ever give an example of for loops that actually ends up on a web page, and not just "console.log"? I'm at my wits end. "document.write" and "console.log" are of no use to me.
@danielstoicamusic7 жыл бұрын
No. :)
@geovaniraffaelli45086 жыл бұрын
You can use it to loop through an array, so the instant someone writes something in a text box and submits it automatically goes to the array and back to the HTML, just like in a bookmarkers app or to-do list app. Dude I was struggling with this too but I didn't give up and eventually I understood it. Don't give up and sooner or later everything will click! Best wishes
@percyblakeney37436 жыл бұрын
Nanika This comment wasn't directed at me but I'm going to pretend it was since it's sound advice I needed to hear (read) at this very moment. :)
@kandysman865 жыл бұрын
@@percyblakeney3743 it's been 7 months, how are you doing now?
@percyblakeney37435 жыл бұрын
@@kandysman86 I have a greater understanding now than I did 7 months ago. I even managed to finally obtain my javascript cert of completion from fcc, however I cannot stress enough the importance of persistence. To be honest I think I may give the course a second go in order to really drive it home. Thank you for asking and for reminding me to get back at it. How's your javascript knowledge?
@jordan00764 жыл бұрын
Who ate my sandwich... MYYYYYYY SANDWICHHHHHH
@cyrilmacauley93836 жыл бұрын
nice.. which text editor are you using that comes with a console?
@zakiulhasan8086 жыл бұрын
I guess it's codepen.io
@zachferell83594 жыл бұрын
how do you increment by two when looping thru an array?
@codynelson44 жыл бұрын
I believe you'd just do i + 2 instead of i++
@DrBotnus4 жыл бұрын
for (let i=0; i < array.length; i+2)
@DrBotnus4 жыл бұрын
or if you want to check all the adjacents, you could do for (let i=0; i < array.length; i++) { let up = array[i-4].something based of your code let left = array[i-1].something based of your code let right = array[i+1].something based of your code let down = array[i+4].something based of your code
@eklavyasharma4 жыл бұрын
My output seems to be overlapping while debugging in Chrome Browser Dev tool. I found the bug when I used the tab '\t' between nested loop. Anyone has idea why the chrome is behaving that way?
@JD-kf2ki4 жыл бұрын
thanks dude
@Fishfood0075 жыл бұрын
What is the practical appilcation to this? I mostly get it and how it works wouldn't know what to do with it though...
@freecodecamp5 жыл бұрын
For loops are used all the time in programming. Here is one example: You may have an array of usernames. You could use a for loop to loop through the array and print every username to the screen in just a couple lines of code.
@djhonz455 жыл бұрын
Thank you!!!!
@orion.56113 жыл бұрын
what if the variable just holds one number?
@debabratasen69555 жыл бұрын
didn't understand that nested for loop
@oamobile84152 жыл бұрын
Who new Ben Affleck was so good at JS!
@benjameerave43293 жыл бұрын
ok i understand but what to do with it?
@orion.56113 жыл бұрын
what if it is not an array?
@igotapochahontas6 жыл бұрын
That voice.....is that taco from the league? Or John lejoie from KZbin?
@struestorystudios92256 жыл бұрын
If i want to loop * how do i do?
@freecodecamp6 жыл бұрын
What do you mean when you say 'loop *'?
@aaronargottelopez34884 жыл бұрын
@liuziyu42727 жыл бұрын
the very last part I still can't understand it's so confusing
@liuziyu42727 жыл бұрын
I don't understand the last part when I=0 j=0 it selects 1, but then doesn't I increased to 1 and it selects the second index which contains 3,4 shouldn't it display 1,3,5? I know the second loop continues if j is less than 2.
@liuziyu42727 жыл бұрын
why does the second loop goes twice first?
@liuziyu42727 жыл бұрын
is it because the second loop is nested inside the first loop?
@freecodecamp7 жыл бұрын
The second loop runs twice because of this part: "j < arr[i].length". arr[i].length equals two because there are two elements in the first nested array ([1, 2]). The first time the second loop runs, j = 0. The second time, j = 1. At the end of the second time, j is set to 2 so the loop stops since j is no longer less than 2.
@eumhiralejandrino8855 жыл бұрын
Grade 9?
@gheorgheslicari17732 жыл бұрын
Can you please to put more accent on explaining things and clean !!! rather than showing up , and yours how you speak !