Class 21: Learn JavaScript Objects #

Introduction

Yeah. Hey, hey, hey, yeah. Boo. Today's the day, folks. Let's go. We online. Hey. Oh, well, let it go. we'll let it go tonight a a oh boom good morning good afternoon good evening no matter where you're coming from hope you are doing well welcome folks welcome welcome welcome welcome hope you're doing well today's a good day you know what today is a good good day I'm super excited you know what like that song comes on I don't know something takes over there's a there's a Leon before stream and then there's a Leon on stream and it's that song I don't know it gets me going what's going on everybody Somebody in here early to what's up? What's up? Hey, come on in everybody. Already it's provocative. Exactly. Well, everybody say what's the news? What's the news?

We can't you know, we always we have a pattern folks. We got we got to build up to the news. We We, we online, we got to build up to it. So as always, uh, tonight is a special night. We got the biggest news ever, folks. It's coming. We got the biggest news ever. Uh, we're getting into objects, which are for me, objects are where it starts to get fun. Uh, once we learn a little bit of objects tonight, next week is fire. We get, we actually get the build with like APIs and, and it becomes real. I don't know I like one of the biggest things I think for students early on is this idea that like yes We're accumulating like all these Legos, right? We have variables. We have functions. We have loops. We have conditionals We have arrays, but like how do we like put those Legos together to build stuff and until you start building?

It's it's really hard to See the results of your effort And so once we add this last Lego block your mind's gonna be blown like the things you'll be able to start building are out of this world, so super pumped for the best news ever super pumped for us to add that last Lego brick, which is objects and We got lots of review tonight as well. So we're gonna be reviewing some of our array stuff Practicing with some of those methods that we haven't really had a chance to play with yet Then we're jumping into objects that better understand what the heck those methods are and we got the best news ever Cool, you know, we always like to start off with some questions if you got questions I possibly got answers Tonight's question of the day if you well today's question of the day is Would you rather be an expert in bird watching or insect? identification so say bird or insect in chat for me please bird or insect first question what's the news oh i thought insects would blow it out i'm i'm into birds i'll i'll say it loud i'm into birds i spent a good portion of today watching some crows uh i'm into birds it's a thing but i like my bugs too i like my bugs too Bird up wow bird really I'm well versed in bird law I'm not a lawyer but I know a little bit enough so that you're going to need a warrant to illegally search my birds I guess if it's bird law right birds all right I think birds blew this one out there's a there's a few insects folks holding out but I think I think I think birds blew this one out the water. All right. Thank you. I tell you, I love seeing these answers. These are like, this is how I get to know you all insects. It's important to know your enemy. Alrighty. Other questions, questions this evening. Oh, Rossi said, are you announcing the group project winners? We'll get to that. We'll get to that. We'll get to that. I got you.

I watched the video on how to make friends with crows, so I'm trying it. I'm trying to make friends with my, my local crew, my local crows. There's a, there, there is a, there is like a, like a pair, like a bonded pair that I see every, every day. So I'm going to make friends with them. And I think there's like a juvenile crew that's like a block over trying to make friends with them to I want them looking out for me. You know, I want, I want my, I want my birds, you know, flying around, making sure I'm good. All right. You got questions. I got answers. What's the meaning of life, the universe and everything 42. What do you think of the ending of the most recent bachelor? I don't want to spoil. I also may not have finished yet. I'm gonna get some of my water in. What should we do if we haven't found a freelance client yet and I don't know if we will before the due date?

Don't fear, on Thursday we're gonna talk through some alternatives to getting a client. So for a lot of folks getting a client's not actually like a possibility. Either you have visa issues, You're in an area that prohibits it from actually happening. You're you're in a space where you just can't do it So on Thursday, we're gonna talk through some other things that you can do that will get you similar benefits to the client So if you're really stressed over the client Thursday, I got you Superman no home. Hey, thank you for the gift of subs. Thank you for being here Yeah, so know that we do have that that date coming very soon I want you to push yourself this this whole process is about pushing you pushing yourself, right? I want you to always take yourself a little bit further than you think you can go. That's the goal It's a boot camp right a boot camp is meant to push you You're not supposed to feel super comfortable the whole way through that would be like a you Demi course I don't know you're meant to push yourself, right? You're meant to feel at some times that things aren't going your way. Sometimes you're supposed to feel the muck that is the trough of sorrow. Sometimes you're supposed to be in that reading doing one of these. All right, what? I just read that four times. I just read that four times. What?

What? Those aren't words. Those can't be words. All right? You're supposed to feel that, right? That's a part of a bootcamp. Because through that struggle, through carrying those boats, through carrying those logs, you start to grow a little bit of a thicker skin. The things that used to be really troublesome start to feel a little bit easier. And you're gonna have days where you're winning and you're gonna have days where it doesn't feel the same. But through the process, you pick up some skills, You pick up techniques that you didn't have before and then when you're on the job and you have to learn something No sweat right no Sweat, that's the whole point The whole point is to build yourself up enough so that when you're in the job and they're throwing new Materials at you news new languages new things at you. You're like I've been there done that this is this ain't no thing I read eloquent JavaScript. You know what? I read eloquent JavaScript. This ain't no sweat I went through that book if I can make it through that book. You ain't got nothing to throw at me, right?

So It's a boot camp some days are gonna feel tough that's okay. That is okay. That's a good thing embrace the suck Open up that closet get in there fight your demons, right? And and then ask for help, right? It's a bootcamp, we're here to carry some boats and logs, but you gotta ask for help too. And you gotta realize that not everything is gonna be your thing, right? There are gonna be some examples that just don't click. That's okay. You have a bunch of other resources. I never just give you one thing, right? I never just give you one thing, right? There's always other things to help boost you up. We come to class, we fill it out. So it's okay. And one thing we have to remember as we're going through this process, yes, it's a bootcamp, yes, we're here to push ourselves.

Yes. We're here to get in the muck and ask a metric crap ton of questions, but we always have to keep in mind health first. Okay. This is something that I asked the last cohort to really embody. I asked them for it to be to be a a thing that they brought up Constantly with each other and I don't ever want this to be like a mocking thing. I really want this to be something that a hundred devs Embodies right the idea that health comes first. We're 21 classes in Jeff and hey, thank you for the 10 gifted subs. Congrats on the new gig, too Oh, these jobs, folks, these jobs. Jeff and A, thank you for the 10 gifted subs. Hope you're doing well. We're 21 classes in. It's starting to get real. It's starting to get real. We got reading. We got doing.

We got code wars. We got networking. We got class to show up to. We got office hours to come to. It's really starting to build. And, uh, oh yeah, 21, 21, 21. And what we have to realize is that our health has to come first, right? We've been doing this for a while, right? We're doing this for a while. We got to start taking care of ourselves better. We have to make sure that we're doing our stretches. You're taking care of your hands. You're taking care of your eyes. You're taking care of your shoulders, right? You're, you're realizing that we're still got a long way to go.

and that fatigue is gonna start setting in. And that fatigue is what's gonna stop you from getting to the end. It may not be your will, it may not be the actual learning, but the fatigue, the tiredness, that starts to set in. And the only way to get through that is to put your health first. It's okay to take a day and not come to class. It's okay. The VODs are always here, they always make it up to YouTube, right? make sure if you need a day to sleep, to eat, to hydrate, to let that fatigue wear off, that's okay. This is a marathon, not a sprint. Please, as we get deeper into it, take care of your hands, take care of your body, stretch, hydrate, do the things that we say when we take the breaks during class time, actually take the breaks. And if you ever need a day, a week, you can take it. We have the catch up crew. You can always catch up and join us live. There's no reason in burning yourself out. And you know what?

It's okay. If there's ever an assignment I give you and you're like, Leon, this is too much for me in the moment. Put it to the side. That's okay. If, if, if eloquent JavaScript took you to the brink and you're like, it's just not worth it. I want to be able to continue. Put it to the side. It's not gospel, right? You can take the things that you need in the moment and pick up the breast as you need to go forward Right. So always put your health first Cool And and and bring this into the cohort right when people are stressing when people are At a place we know that they could probably be prioritizing health bring it up Don't ever do it in a mocking way, but let's let this be something that we embody Coding challenges, oh, oh, the folks have been diving deep. Some folks have been spinning out these coding challenges are taking the best of us. So coding challenges, I'm addicted, yeah, some people go in all of them. They're fun. I know if you don't, if you haven't seen the fun in them yet, give yourself a little time. They can be really fun.

They can be something that winds up being like, it's like nerdy crossword puzzles, right? Even nerdier crossword puzzles. They can be fun. You gotta get into them and you gotta make them part of your daily practice. And the very first couple times you do your coding challenges, they can really suck if you've never done them before. So we brought this up during office hours, but please make sure you are doing level eight. Make sure you are doing the eight cues. Make sure you are doing the fundamentals track. Rockefeller A, make sure you're doing the fundamentals track. If you're not doing eight cues and you're not doing fundamentals, you're off doing some wild stuff, right? Right, you're off doing some wild stuff. You need to be on eight cues, you need to be on fundamentals, and you're gonna be there for a while, okay? If you're trying to do anything else, it's too much. Now, the first time you do Code Wars, you're almost never going to understand how it works or what to do. You're gonna look at the question, you're gonna go, what?

If in that moment you have no idea how you're gonna even approach the topic, just look at the solution. Just look at the solution. Just look at the solution. Just look at the solution. There's no such thing as cheating. There's no such thing as like, like it's just, it's just so weird. Just look at the solution. You're here to learn. The reason we do code wars not is not because like we just want to do something every now it's because we're here to learn. So if you're looking at a problem and you have no idea how you're going to solve it, it makes no sense to sit there for an hour banging your head against the keyboard when you could look at the solution and then spend more time on the analysis than you did on trying to solve. And that's how you learn to become a lean mean interviewing machine. When you see these problems and you have no idea how to even get started, just look at the solution. Then spend more time analyzing the solution, typing it out, retyping it out, retyping it out, doing it again, looking at the question without the code pulled up, make sure you can pass it right spend more time on the analysis and practice than you did on trying to solve it and eventually after you do a few right right now after you do a few right after you do a few the it gets easier you start to understand how things play out you start to see the same patterns and so the code wars is really about patterns and so until you have those patterns look at the solution, please. And then make sure you're doing ones where you can see the patterns over and over again. So like once you start to come out of fundamentals, only do array problems, then only do object problems, only do the things that you wanna practice in that moment so you see those patterns over and over again, okay?

But don't beat yourself up if the code wars don't click the first couple that you do. Look at the solution, spend more time on analysis than you do on the solving, and that's how you grow. On Sunday, we talked about chess grandmasters, and I think this is important to bring up again because I know people are in the thick of it right now. People that are really good at chess, like grandmasters at chess, like the best competitive chess players, they don't get better at chess by playing more chess. I think that's a weird thing for most folks. They don't get better at chess by playing more chess. They get better at chess by analyzing their games or other games, right? They spend more time looking at, all right, here's what this person did. Then they did this and they did that. Then they did this and then they did that. All right. And I see this pattern and that can lead to that, right? You spend more time on the analyzing than you do on the actual playing. It's the same thing for your code wars. in the beginning, spend more time analyzing.

Even if you get the code wars right, look at the other solutions. What did they do? How did they do it in less lines? How did they do it more efficiently, right? The analysis is more important than the solving in the beginning. So spend time looking at your solution, other solutions, and make sure you understand how they're doing and approaching things. And that's how you really grow very quickly at the stage that you're at right now. The more you put into Code Wars, the more you're going to get out of the next chunk of class because Code Wars forces you to put all the things that we're learning into practice. It's really hard to see all these Lego bricks and not know what to do with them. Code Wars forces you to use them. And so your Code Wars combined with projects that we'll do in class, that's the cheat codes. Super pumped when I wrote a proper arrow function today on the JS 30 homework. Hey, that's awesome. Two dimes. Beautiful.

230, not for a while. Alrighty. We're getting ready to have a live portfolio and resume review session. If you would like to have one of your resumes and portfolios reviewed live, fill out this form. I'm gonna pick a big handful of folks Kind of give you a slight little roast but through that roast thing We can see all the things that we think portfolios and resumes should have and we'll do it in a constructive way And hopefully you walk away with a really good idea of how to structure your portfolio and resume for the next stage of program Now folks We're turning things up We got through the big four. We got through our variables, our functions, our conditionals, our loops. We added arrays. We're gonna get some practice with arrays today, but then we're adding objects. Once we add objects, we're dangerous folks. We're real dangerous. We're real dangerous, right? We're real dangerous once we have objects. We're gonna start using APIs. We're gonna start being able to get data from other places and manipulating that data, showing it to our users, is building larger projects that are actually really freaking cool. All right.

And then we move into the backend. So we got some, we got some, some objects to do to start building some real meaty projects, some projects that are going to be in your portfolio, hopefully for the rest of your life, we're turning it up a little bit, turn it up. Well, you know how we do, we always get our review in. We always make sure that we, we, we, we, we keep progressing at a good pace, but Our projects are going to get better. The things that we're able to do are going to get better. Um, and so even though we're in the trough of sorrow, right. Even though we're in the muck, it gets eventually if you're rolling around in the mud enough, you start to have some fun with it, right? If you're rolling around in the muck, you start to have some fun with, he starts to build some mud castles, right? Right. That's what we're going to be. We're going to be in the muck. We're going to be in that trough of sorrow. We're going to have some fun with it. We're going to build some really cool stuff while we're in the middle of that muck. And I guarantee next week and the week after, it just gets a lot more fun.

Like the practicality of what you can do and build and work with real data, build real projects. That's when it becomes a lot of fun. So you put in the work, let's see that work come to fruition and start building some really cool stuff in the next couple of classes. What about React? We do back end first and then add react at the end. That way we can build full stack web applications and then see what react adds into that mix for us. Jada said Elkin JS equals trough of sorrow, code wars equals wiggles of false hope. We're nowhere near the wiggles of false hope, but I like the analogy. Alrighty, kind of talked about this a bit, but we have the Legos now. We have all these different Lego pieces. We got our variables, our functions, our loops, our conditionals, our arrays. Then we add objects. Now we have the pieces we can start to build. And so for folks that feel like they have all these pieces but don't know what to do with them, your code wars help, and then the next couple of classes help. We're gonna build some cool stuff.

You're gonna see how these Lego pieces come together. So if you need a bigger picture, it's coming. Trust me, it's coming. But we needed the Legos. We needed the Legos before we could put it all together. Now we can build. Exactly. Alrighty, folks. The moment we've all waited for. The big news. Now, I put my warning up here. I'll try to keep the warning in the future for whenever we use this code party section. but next slide is gonna be loud because we got some big news. So I'm gonna go over here to the big news and then we're gonna hit it. So in the next 10 seconds or so, we're gonna have some confetti, some loud sounds.

So late 2020, I had an idea. It was a pandemic and I wasn't a doctor, I wasn't a nurse, so I didn't know what I could do to help. But I had an idea. I said, you know what, I think I can help a few folks maybe become software engineers. And so we did a very small cohort of folks and hundreds of people showed up. I was really expecting 10 folks here with me on Twitch and that and that was it and Then that first like five week course we were like, holy crap We might be able to do this and we might be able to teach a class live Online we online folks Maybe we could teach a class. Maybe we could teach it online and maybe we could we could build a community of folks that that could go the distance, that could learn how to code, that could build some phenomenal projects, that could get some phenomenal clients and could maybe get some jobs. And so we did that first run. And then in the second run, we set, well, at least I set the biggest goal of my life. One of the biggest goals of my life. One of the things that I've ever, like one of the biggest goals I've ever put out there publicly and said, I wanna do this thing, right? I want to do this thing. Nobody else has done this thing. I want to do this thing, right? Nobody has ever done a completely free coding bootcamp online, put everything out there for free and in the public, and I set a goal.

And the goal is the namesake of our bootcamp, our agency, and the goal is a hundred devs. And I'm here to say, we did it, a hundred plus jobs, a hundred jobs, a hundred new software engineers that are employed, getting paid, learning how to code. I'll save our ears, but we did it. it. We hit over a hundred jobs over a hundred jobs. We're not at a hundred. We're over a hundred, a hundred software engineering jobs and a whole smattering of other jobs that are in the related field as well. But a hundred folks that came to a hundred devs and got the support they needed to learn, to grow, and to get a job as a software engineer. We threw out into the world, the idea that a hundred devs meant a hundred jobs. And we smashed through it. We smashed through it. We got our a hundred. We got more than a hundred and we got folks going to some amazing, amazing companies, amazing jobs. We got folks going to, uh, the, the, the, the, the companies around the block. Those are my favorite where they can walk to work.

We got some folks going to really great startups. We got some folks going to Fang. We got some folks that never even thought about code, but saw a frickin post on Reddit. And now they're making six figures. We had some folks where their whole family came, where the husband and wife came and they both learned together. And now they're both employed. we got folks that are in dozens of countries that have gotten jobs. Our first job was somebody from Brazil, our second was somebody from the UK and it kept going around the world. A hundred jobs plus. So we hit a hundred but we're just getting started. We're just getting started. So the best news ever is that we hit our hundred, but I think we got some big things coming our way. I think we got some amazing things to come our way. I think we can do something a little bigger, maybe a little better. Maybe a little bit bigger, maybe a little bit better.

Because let me, let me, let me throw some numbers at you, let me throw some numbers at you before I get to my thank yous before I, before I get there, let me throw some numbers at you. When we were doing the original hundred devs, like legit cohort, we had about 300 people that were watching the streams, but really only a hundred people were turning in the homework. So all of the homework you can see is public. This is something that's interesting. Like, if you want to see, like, who was really participating in 100 devs, you can actually see all of our homework assignments actually wind up being on GitHub. So you can literally see the people that were submitting their homework, right? So we had about 300 people on the stream, and we had about 100 people actually doing the homework and keeping up. We got over 100 jobs, right? We got over 100 jobs. So for me, the folks that were keeping out doing the work, I feel like we got a good clip of them. A good clip of the folks that were doing the full work, we got them, right? Now we're seeing kind of similar things with this cohort. We got about 3,000 people that come up to class. About a thousand plus are doing every single bit of homework right so for me I feel like if we can keep the same numbers if we can keep the same numbers I think we might need to get a new goal I think some things might need to change but before we get to that before we get to that before we think about the things that might need to change I gotta I gotta say some thank yous I gotta say some thank yous. Because it didn't happen, we didn't hit this hundred, we didn't hit this hundred by accident.

This doesn't happen by accident. This happens through a lot of hard frickin' work. And it's not myself, it's not our fearless moderator crew, it's not all these folks that help make 100 devs run. at the beginning, it's y'all, it's your work. We can't make you show up. We can't make you come to class, do the homework, do the code wars, do the networking, get the clients. That's y'all. And so for the hundred folks that got jobs plus last cohort, they showed up time and time again. They put in the work, they put in the hours, they did the networking, they did the portfolio building, they built their 100 hours projects, they got their clients. And at the end, all that hard work came together where 100 plus people got some amazing, amazing jobs. So the first people I need to thank are all of our alumni, All of the folks that put in that work to make a hundred devs what it is for me to be able to claim a hundred Right. I don't get to claim a hundred unless you all do the work So the first people I got to thank are y'all for showing up put in the work and doing it because I can't claim that number Unless you do the work So, thank you. I really really do from the bottom of my heart Thank every single one of you that show up that give me a little bit of trust a little bit of time I'm going to get you there. If you're here, if you're part of this cohort, I'm going to get you there. Give me a little bit of trust.

Give me a little bit of time. I've now literally gotten hundreds of people jobs through this program. Hundreds of people's jobs through this program. And we're just getting started. Now, there are some other amazing folks that we have to thank. And my thank you is going to be a little odd here because we're going to do something bigger, right? First and foremost, I have to thank our moderators, our fearless moderators that are always here in Twitch chat, on Discord, Discord's the wild, wild west, y'all. Nobody's ever done this. Nobody's ever thrown 28,000 people into a Discord and have it run with the level of success that we've had. We went from like 0 to 28,000 in less than a year. And so that to me is absolutely wild. Well, sorry, we went from like 2,000 to 28,000 in less than a year. So that, if you've ever been on Discord and it wasn't a hot mess, if it wasn't run amuck with trolls and spam, that's because of the moderator team. And so I'm gonna thank each moderator personally, but tonight's not that night, I have something bigger planned so each mod. I'm gonna thank individually because they deserve it But that's not today.

That's gonna be that's gonna be that's gonna be it and something that we're gonna talk about in a few seconds Then I have to thank all of our mentors our Helpers our folks that show up time and time again to help folks in the community that answer questions in our help channels that answer questions our support channels this doesn't work without y'all to and And then the biggest folks, again, the alumni that are in those channels, answering your questions, giving up their time, they already went through the boot camp, they have a job and they come back on Twitch on discord to continue to help the next group of folks make it through. That to me is the whole point of this. The whole point of this is not a hundred jobs. It's for those folks to now bring three more with them. So a hundred quickly turns into 300. And then I think we have some bigger goals that we need to hit too. And we made that ask. We made the ask to our alumni. Hey, come back. Can you help with the study communities? Can you help with new events? They answered the call every single time. And so a huge shout out to the alumni that come back and give their time. They made it to the promised land and they're coming back to pull more folks with you. So, we thank you for being here.

We thank the alumni. We thank the moderators. We thank all of our helpers on Discord. But I want to do a little bit something bigger. I want to do something a little bit bigger. And last cohort we did something that was one of my favorite parts of the cohort. And we're gonna do it again. I'm introducing the best week ever. Now, last cohort, we had the best week ever, but this cohort, we're really about to have the best week ever. So, next week will be the best week ever. We're gonna do some really amazing stuff. We got some things that people have been asking for a long time. We got merch dropping. We got agency opening up. We got job board opening up.

We got merch. We got a sponsored class by Microsoft. We got a lot of stuff, folks, that we gotta get these wheels moving. We gotta get these wheels moving. We got too many of us into really great places. We gotta keep it moving. So next week is gonna be the best week ever. We're gonna have a chance to thank all the folks that have made this happen, to reveal some really big stuff, Open it up way bigger than we've ever done it before. Have a sponsored class by Microsoft. Next week we learn Git and GitHub and Microsoft is sponsoring it. GitHub is sponsoring it. We got swag. We got laptops. We got amazing stuff. So today was the best news ever.

To set a goal and to knock that goal out the park through the stratosphere to be way past 100 jobs. We're past 100. Like like I don't know if you've been paying attention to that celebrations channel, but uh It's been kind of blowing up recently like every day. There's somebody new in there and so We're way past 100 Uh, I could I I really honestly when I mean i'll talk about this a little bit every once in a while I really thought it'd be me and 10 people max and I would help those 10 people and that would be it Uh, so I can't in my wildest dreams ever imagine that we have Uh, 3000 plus people here, all trying to learn how to code, maybe change their lives, maybe get that job that they've always wanted, have that security for themselves and their loved ones to have a career that's high growth that they know is setting them up for life. If you're here and you're ready to put in the work, I got you. It's no longer a hundred. We're going for something bigger. So at this moment We're setting up the best week ever and on the first day of the best week ever I think we got some big changes to make I think we think we need a new goal and so Come back next week for the best week ever Because we got some bigger goals to hit we got some bigger things. We got to do we got to bet We got too good of a community We got too good of a community to stop at a hundred This is the best place to learn how to code live online. We online folks are learning how to code. And if you're here, I know that you can do it too. I know that you can join these hundreds. You have the ability, you have the aptitude, you have the will, you have now the way that a hundred other people have followed. You can do this too. Give yourself a little bit of grace.

Give yourself a little bit of trust. Give me a little bit of trust in return. I think I earned a little bit of trust. I think after you get a hundred people through that through that gate. Yeah, I think I got a little bit of trust But give me a little bit of trust and we'll get you there, too alright folks Thank you for Enabling me to hit a goal that I said that I really wanted to accomplish This really is one of the best things that I've ever been able to accomplish in my life It's something that I am super proud of and it's just getting started next week best week ever Alrighty, let's get into our review. I know I feel like we're on top of the world. I'm just gonna like alright JavaScript Now it does like JavaScript we had a lot of folks that did some stuff but I was in I was in ranty mode House let me make sure I go through these we had some sound alerts. We had a hydration Lip dab, thank you for the hydration. Cheers to you and a lot of sound alerts Dab was in here a. All righty, folks, thank you so much. He humble a thank you for the five gets the subs. Appreciate you. Thank you for being here. Oh. People are saying what about the funnest portfolios, the funnest projects?

Well, since we're revealing the merch next week, we'll reveal who wins because they get that merch. So we'll wrap that into the best week ever so that folks that know who they're winning act who won actually know what they're getting. Yeah. Cool. All right, let's get into our review. Let's get into our practice here. Programming. Remember, I feel so, it feels so wild to just jump right into this. A computer will do what you tell it to do. All right, a computer will do what we tell it to do. What is a program? Oops, I'm sorry. I'm still in video. Computer will do what we tell it to do. What is a program?

Well, a program is a set of instructions that we write to tell the computer what to do. What is programming? Programming is the task of writing those instructions in a language that the computer can understand. We use JavaScript to write those instructions because it's a little bit more human readable. It's something that we can understand and share that can then be broken down into something that the computer can understand. JavaScript has a specific syntax that we've been learning. All these little extra bits and bobs that make up the spelling and grammar rules of the language, parentheses there, curly braces there. JavaScript has a specific syntax that we have to learn and pick up. We learned about the big four, right? I'm too hyped to focus. I feel the same way too. I'm like, ah, we learned about the big four. We learned about variables. Variables are a way of storing a value to be used later on. We literally store it into the memory of the computer so we can use those values later on.

We can declare a variable and assign it at the same time. That's what we're seeing here, a declaration and an assignment. We also learned about conditionals, where conditionals are where we check to see if something is true. And if it is true, we do it in those curly braces, and then we stop, that's it. But if it's not true, we move on to our else if, to check if that's true. If it is, we do what's inside those curly braces, and then we stop. But if the if is not true in any of our else ifs, because we can have multiple or not true, our else can auto-magically run. And if that else auto-magically runs, it doesn't check anything. It just does what's inside the curly braces. It talks about danger of assignment versus comparison. This idea that when we're inside of our conditionals, if we just do one equal sign, that's assigning a variable. It's not comparing anything and we'll run into some issues. All right. We learned about multiple conditions where we can have this double ampersand where both of these conditions must be true. And today is the day where I feel it the most folks.

Today's the day where I feel it the most, where my name is Leon. And in this moment, my status truly is Ballin. That's all I'm going to say it. Hey, you get a wink. There you go. Can't say shit to me today. That's all I got to say. We also have, or we also have, or where, as long as it is Saturday or Sunday, just one of these conditions is true. Then we can say it's the weekend. We learned about functions chat. What are functions? What do they enable us to do? What do they enable us to do? Yeah, they're just sets of instructions. They're our building blocks.

It's how we build up our programs. It's just sets of instructions and they're reusable. The cool thing is that we're starting to see these functions kind of seep in everywhere. At first, we just had regular function declarations, right? where we had a function and then a regular call. But now we're also seeing like anonymous functions where they're kind of thrown in, where functions are taking in functions, right? We have this idea of like higher order functions and these other things that are coming in. We're passing in arrow functions. So they become a really essential piece of how we write our JavaScript. And it's really important that we understand how to use them. So we're going to see a lot of functions today. Again, we're going to see a lot of functions being used with our methods when it comes to arrays and objects, but they really are the fundamental building blocks of our program. They're meant to be reusable so that we can repeat actions without having to retype the code over and over again. So here we have a function call. We're passing in hello as an argument.

It falls into our parameter of word. Wherever we see word, it's actually hello. You can think of functions with parameters as Mad Libs. Exactly, Dab. That's a really good analogy. You're just filling in the blanks. Beautiful. Loops. What are loops? Dab, when are you streaming again? Come on. We need you back. We need you now more than ever. I'll wait. Can we get a stream, Dab?

You just got your new computer so soon? Hell yeah, let's go a dad's part of our stream team These hundred I didn't think the stream team the stream team willed folks across that finish line There are folks on this list of the hundred that are only there because of what dab did What what what OCC did and in creating a space where they can continue to learn where they could ask questions So there are folks on this list that pulled up, pulled individuals through, whether through code or support, they're on that list because of them. So big shout out to our stream team. Dab, we need you back. OCC, we need you back too. I see you in chat. Let's go. Like I said, I wanted to put out the general thank you, but next week, best week ever. I'm putting it every, I'm calling you out. Your name's gonna be in the slides. If you don't want me to put your business out there, let me know. Cause we got too many big folks to, to, to, to think that a, thank you for the gift of subs. Thank you for being here. Thank you for all you do. All right.

Loops. What are loops? We already saw some folks in chat. We have the ability to repeat an action multiple times, right? We have the ability to repeat an action multiple times. We saw a couple loops so far. We saw four while, and we got to a raise. is we saw a couple other big loops as well. We saw things like for each map. We're gonna see some other ones today too that enable us to loop through content and do some stuff with it. We have our traditional for loop where we set up our increment. We say how far until the loop stops. We go up by one each iteration. And so in this case, we'd be just printing our numbers to the console until we hit our end condition. Beautiful.

We also have a while loop, which is another similar loop where we start off our count and then inside of our count We go up by One each time so a little bit different where we don't have in our for loop all the stuff set up right away We have uh the increment that we're keeping track of we're incrementing it inside of the loop and we still have our condition It's being checked each time cool I don't get there between I equals zero and I equals one. When do we use one versus the other? All that is is when you want to, all that is is when you want to start, right? All it is is when you want to, where you want to start. Do you want to start counting at zero or do you want to start counting at one? The reason why you will see a lot of folks start off with zero, especially if you're working with arrays, right? If you're gonna loop through values in an array, it's always probably a really good idea to start with zero because the index of that array starts at zero, right? So if you started at one, you would always skip the first value in the array. Cool. So in that case, if you're looping through things in an array, you have to start at zero or else you're gonna be missing things. If you're just trying to use the increment as a counter, you don't need to count zero. You can just start at 1 so like if you're trying to say like 1 2 3 4 you can start at 1 But if you're working with arrays You're probably gonna start at 0 and a lot of engineers kind of just start with 0 out of habit Even if they were just gonna count they would still start with 0 All righty Today we have all of our review code is Power Ranger themed We're going to get some morphin time going on. For those that don't know, the best TV shows ever made are The Bachelor, followed up by the Power Rangers. We of course have today highlighted for us the Mighty Morphin Power Rangers. Then we'll move into the Alien Rangers.

Then we'll hit some Zeo. Maybe a little bit of Turbo, you know? If we're feeling really, really good, we'll maybe do a little bit of Space, a little bit of Lost Galaxy, a little bit of light speed, you know? We'll slow down, though. We'll slow down once we get the time force, space force, you know, all that fun stuff. But for tonight, we're gonna start with our Mighty Morphin review. Let's go ahead and open that up. Hold on, did I not have it open already? One second. Okay. There we go. I'm gonna open it up. We have the Mighty Morphin Review. Let's go ahead and open up this Mighty Morphin Review. We have the JavaScript file.

There's review for variables, functions, conditionals, and loops. We're gonna put where we at time-wise let's put seven minutes on the clock here Seven minutes on the clock see how far you can get in these seven minutes and Then we will stop we'll take our break and then we'll come back from the break to review So seven minutes on the clock you got this dig deep and then we'll review After our break so seven minutes again, you got this mighty morphin review Blossom, we're about to see some flexasauruses. Yeah, they can't help themselves. Not the Jurassic, but they gotta go hard. Update your VS code? No, I haven't read the release yet, the release notes yet. I haven't read the release notes yet. I don't update a definitely not midstream. Let's just just click that little XC poo there live dangerously. Where can I find the stream team folks? Yes, we have a special channel. So whenever folks go live on the stream team, you can see their notification and go live. There's a stream team channel on Discord. Make sure you turn that notification on. As we have folks streaming on the stream team again, we have a lot of new folks that are kind of in the process of joining the stream team.

We have two that are ready to go. And so as part of the best week ever, we'll have their joining of the team and we'll make it a big deal. Can we have another Twitter space with folks that got jobs? Yeah, our goal starting next week with the best week ever is to do a space every week. So we're going to be mainly doing discord spaces because it's a little bit better and it's just us, We don't have to worry about the riffraff coming in. Oh, yeah. So we'll be doing some Twitter spaces, but a lot of Discord spaces as well. And we're going to try and do that once a week. I don't understand what the stream team is, it's just a group of folks that stream learning to code or coding that are part of the 100 devs family. What's the drink? I got some vanilla chai tea and some ice water Seltzer tonight, that's the move. I like seltzer, but it makes me um Do some sounds I don't think y'all need to hear Yeah, I like that too blah said no code weenies no gatekeepers. Nobody trying to sell you anything exactly I ain't trying to beyblade it up on stream Can I buy a sub with my Leon dollars? You can get all the stuff like you can you can get all the emotes and stuff by using your channel points Yeah Jam the stream team is on twitch What that that's amazing. Yeah, promote it to mid-level right now.

You're working on first solo large site wide feature. That's amazing. Congrats. That's huge. Well deserved. Do you get more channel points if you sub unfortunately, yeah, unfortunately when you sub that like increases the rate. Um, yeah I mean, it's a perk but I don't want folks to ever feel like they have to sub Jw 330a thank you for the hydration. Cheers to you Uh, Candice, sir, is there some setting to make the commands work? No, sometimes just multiple people have used the commands and so it's not like it tries to stop people from spamming them basically Uh jay john, this is stream beats by harris hiller Kabaddi all of our subs and donations and stuff like that go to resilient coders, which is the nonprofit I work at during the day, which will probably announce in best week ever because we need to make our next like big, uh, big payment. Can you promo Megazord with JavaScript? That'd be a fun, fun project. All right, folks. Come on back, come on back. All righty, so let's take a look at the first one together and then we'll take our break. We'll take our first one together and then we'll take a look at the break.

We'll take a look at the first one together and then we'll take our break. Well, declare a variable, reassign it to your favorite holiday, make sure it's in all caps, and print the value to the console. If you want all the cap, what do we have to do? Want it in all caps, what could we do to make it all cap? Ah, two uppercase, two uppercase. So let's go ahead and create a favorite holiday. So let favorite holiday equal, and we're going to say Halloween, beautiful. And then I want to reassign it to be in all caps. So I'm going to say fave holiday equals fave. And I could have done this all in one line. I'm just going to do it for readability. To uppercase, beautiful. To uppercase and then print the value to the console. So console.log and we'll print favorite holiday. Let's save this.

Let's make sure that it is working. Open in default browser. Oh, look at that. That's good. This is tradition. I have to do all the poses and then we'll see if it worked. All right, let's go ahead and do it. All right, we'll do black first. Yellow, we're gonna go ahead and do green next. Red, we're gonna do pink. Before there was Charlene, there was the pink ranger. And then blue, there we go, nice. Now we can see if it worked. All right, first try. Halloween is all capitalized, right?

All capitalized and it looks like it's working and so what we can do now is we can rest assured that we can take our break. So five minutes on the clock. If you're new around here, we like to be healthy. We like at the top of every hour to make sure we're letting our fingers and our eyes get a little bit of a break. So if you're able, please get up, move around, on hydrate and then be back in five minutes. We're going to go through the rest of this together and we're going to move on. We got a lot of fun stuff to get to tonight. Really excited to get through a little bit more review and then get into our objects. Once we get the objects, the things, things start to everything starts to kind of click a little bit start to learn some of the mysteries that is JavaScript. So if you're interested in learning the mysteries of what is JavaScript, I'll see you in five minutes. You I should, I think I forgot to run ads, whoopsie. Yeah, I don't think they ran. We always open up the links to submit the clips after class. So it'll be open after class. Super behind on the reading.

That's okay, Noro. It's a lot. The reading this week was particularly a lot. So you'll notice that we've given a little bit more time for some of the reading. Lena locks. Hey, thank you for the raid Hope you're doing well. Thank you for being here. Thanks for bringing the crew along. Are you working on? Where you up to this evening How did the bug fixing today nice How did the the vote go the I know you were up for the the award? How did that shake out? Oh, has that happened yet? Welcome Raiders, hope you're doing well. For those that are new, we're doing a 30 week software engineering bootcamp. That we're viewing some arrays and going into objects in JavaScript.

It's announced Friday, all right, let's go, turn up. Fingers crossed. Alright folks, come on back. Let's get in here You're not following Lena Lux, you're out of your mind at this point, I'm gonna throw a shout out in chat Boom All right, I'm just gonna copy this myself Definitely give them a follow if you haven't followed yet Boom. Alrighty. Welcome back. Let's chill the music here. We got some review to get through. So before the raid, we had started working through this review. And so we had 10 minutes to do review, then we took our break. So now we're gonna finish going through the problems together. All right. Declare a variable, assign it a string, and then alert the last three characters in the string. So this is one of those ones where you probably had to do some research. I had to do some research on this one.

So let's go and take a look at it. Let's go and do the first thing. Let's declare our variable. So let's go ahead and do let fave power rangers equal. And then I am gonna go with, Yeah, I'm saying it. I'm going to say it. I'm going to say it. How'd that? I'm going to say it. Not the favorite ranger. The favorite rangers too. That's that's not something we can come to terms with tonight. Like do you do you go black ranger? Do you go green ranger? Does the white ranger separate from the green ranger?

What version of power ranger are you talking about when you mentioned the green ranger? Because it changes We can't get there tonight, so I'm gonna say my favorite favorite Power Rangers series Series there you go Beautiful favorite Power Rangers series because we can't get into that tonight ninja storms up there. I see some folks throwing that out there I'm gonna go alien ranger that that's where that's where the game got changed the Costuming the like the movies. Ah, that's when I hit a stride folks. All right, so I want to alert the last three characters of this string. So alert, what could I do? We came up with a way to grab just the last three characters. Ooh, I see some folks with the slicing. I like that. Let's try that. Slice. So we're gonna do fav power ranger series. We're gonna do slice and we're gonna do negative three because we want the last three characters. So this is one of those methods, right? We haven't, it was in some of the reading a little bit, but if you didn't see it in there, you had the research, you had to figure out, all right, what can I use to get the last three characters?

It's something you had to Google, you had to dig deep, find a method. So let's see if this slice three, negative three works, and then we'll talk about why it works if it does. Let's go back, let's refresh. Errs, all right, errs. Did that work? Errs. Let's see. Errs is the last three letters of alien rangers. Beautiful, that did work. So we have this slice. And slice is a method that could take in a bunch of numbers and what we notice, if we pass in a negative number, it takes the last three. So it's a beautiful way to just grab pieces of the string. Are there a bunch of other methods that you could use? Yes, there's substring. There's charAt.

We could treat the string as an array. There's all these other things that we could do. And one of the things, and one of the reasons why I asked you to do your code wars, right? No, Jones, the reason I asked you to do your code wars is because you learn all these little tricks and these gotchas and these methods and you get to use them in a particular place. So that's a cool one. All right, first string. Functions. Create a function that takes in five numbers. Subtract all five numbers from a hundred. Alert the absolute value of the difference. Call the function. All right, so let's go ahead and create our function. We're gonna call minus five and abs for absolute. And we're taking in five numbers. Our parameters can be whatever we call.

We could call them rainbow, unicorn, monster, firetruck, ping pong, it doesn't matter. But we're just gonna know that their numbers So we'll do N1, N2, N3, N4, and N5, beautiful. And then we have to subtract them all from 100. So let's set up our variable here, let difference equal 100 minus N1 minus N2 minus N3 minus N4 minus N5, there we go. So that's the difference. And then alert the absolute value of the difference. So let's go ahead and do our alert. And how the heck can we get the absolute value? Ooh, thank you, chat. We got the math.absolute. And that's one of those things, like if you didn't know how to do it, you would have to go to the Googles, right? Absolute value in Java script. I might even throw an MDN on there just to get there, because we see the MDN has a math.absolute. Beautiful. Always go straight to the MDN.

All right. There's an absolute function that returns the absolute value. So even if I didn't know what absolute value was, right? Even if I didn't know what that was, I could see that, oh, it's built in with this math object that we'll get to. In the MDN, we trust exactly. Now I can go back. I can trust that math.absolute is the right thing. And I'll pass in difference. All right, let's call the function as it asks and we'll try it out. Had to use that on my code wars today, that's dope. That's awesome. Cool. Let's go ahead and do minus five and alert. I've got minus five and absolute and we're gonna pass in some numbers. Let's pass in 27, 83, 42, one, One and five.

Beautiful. Let's go ahead and run this and see what we get. Man, these poses just get you going. It's just when you're like. No. What am I talking about? Anybody ever gives you a problem, just hit that pose. Boom. Gets you going. All right, let's refresh. 58, all right, so it works. So we got the absolute value of 58. And we know that the absolute value is working because this would have, subtracting from 100, we would have been way below zero. And so the absolute value, the absolute value is working here because we're not getting a negative number. It's giving us the absolute value.

Um, people are saying, uh, interview pose. Could you just imagine you're in your first technical interview and the whole time you're, you're just like this, just like, you just, you just hold in the pose, you're beast in the interview, by the way, right. You're beast in the interview. Right. But after like each question, you're just like, ah, right. They give you a behavioral question. You're like, ah, they, they, they give you a technical question. You're like, ah, right. But you're still, you're, you're crushing it. Right. I think you said I think you still get the job. I think if you're busting out the Power Ranger poses and you're crushing it That's all that's all the better. You heard that here. That's my that's my advice in technical interviews Please bust out your Power Ranger moves guaranteed to get the job We don't get got dark shinobi a thank you for the hydration. Here's to you Instant 20K hiring points, exactly.

All right, first try. Go on to the next one here. Create a function that takes in three numbers, console log the lowest and highest values. Interesting, all right. Function log high and low. And we're gonna take in three numbers. So we'll take in we'll choose the same kind of thing and one and two and three and console log the lowest and the highest Values and so for me the lowest and highest values. There's a couple ways I can get them Anybody know what they what they did? Well, I'm seeing some folks throwing out min and max. There is a math dot min and a math dot max. That is true Let's go ahead and do that. Let's go ahead and say let min equal math.min, and we will throw in n1, n2, and n3. And what that should do is based on these values that we passed in, it should give us the minimum value and place it in the variable min. We could have also sorted it. That would have been a different way to go about it, like sorting it and then taking the first and last.

That's totally a way that you could have done this as well. But let's see some of these methods, right? We'll see sorting later today. We'll see some sorting ones later on. So we'll come back to the sort in a little bit. All right, so we got math.min. Let's get max. Math.max. Let's pass it in one and two and three. Beautiful. So now we have the min and the max. Min and the max. Now we have the min and the max. What we need to do is like use them. Let's go ahead and what does it say it wants us to do?

Console log. Let's go ahead and do our log. And we will, let's use a, let's use a template literal. When I use a template literal, or what am I starting my string off with? Like how am I setting up my string? Could you have done this without declaring variables? Absolutely, but I like the readability of having the variables. I gotta use the back ticks here. So I'm gonna say the lowest num is, and then I can use my bling syntax where I can then go ahead and just put min in here, is blank and the highest num is, and I'll use my syntax again and I'll throw in max. So the idea here is since I've used my back ticks, I can plug variables in using this bling syntax where I do dollar sign and then the curly braces. Now let's see if this works, let's call it. So we'll call log high and low, and we're gonna pass in some values. Let's pass in 100, 50, and 25. So if this works, we should see 25 and 100 in the console. Yeah, way better than concatenating exactly juice.

Let's go ahead and save this. Let's see if it works and let's see where we're at. All right, we got the errors, we got the 58, and then we see the lowest num is 25 and the highest num is 100. So it looks like it's working, right? Looks like it's working. Bing, bong. All righty. And we can take a peek at this, right? First try, we can take a peek at this where what we do is we passed in all three numbers, right? As our parameters. And we passed our parameters into this min, Into this min and that just grabs the lowest number out of the three that we had passed in same thing for max It's gonna grab the highest number out of three that we pass in and then I'm just gonna use my template literal here my template String here and I can pass my variables in without having to do any of that nasty nasty concatenation My bling syntax didn't work make sure you use the ticks and not quotes You don't use the backticks, it won't work. The backticks are on your, on your, on your tilde key. So here's a normal keyboard. And then like right above the tab is the tilde key. That's what you're gonna hit.

Boom, boom, boom, boom, boom, boom. I can't show you on my actual keyboard. My actual keyboard is in a very different spot. right there, but on a normal keyboard, that's where it is. Above the tab. Yeah, and then like different countries, it's gonna be a different spot. Cool. I just showed you how dusty my keyboards are. It's kind of embarrassing, but it doesn't matter because first try. All right, next one. All right. Create a function. create a function that returns heads or tails randomly as fairly as possible and call the function. As soon as you know we're going to be doing something randomly, what are we probably going to be using? Ryan, it is, yeah.

Yeah, math.random. So we're seeing this math object comes with a lot of goodies and we're going to use this random one as well. So let's go ahead and create a function. Since we're getting heads or tails, we're gonna call this heads or tails. And let's just go ahead and set up the result of the flip. So we can do let result equal, and then we'll do math.random. So what math.random is going to do is it's going to return a value between zero and one, right? Math.random is gonna return a value between zero and one. So if we want it to make it a 50-50 result, if we want it to be a 50-50 result, a heads or tails, we could set up a conditional, right? We could do a conditional that checks for one half or the other half. So what I'm thinking, I'm just gonna set up a condition. I'm gonna do an if, and I'm gonna say if result is less than what? Less than 0.5, exactly. If result is less than 0.5, we can, I was supposed to return, so we'll return heads. I guess we have to return like a string of heads, right?

Return a string of heads. And then if it's not less than 0.5, the only other thing it can be would be what? The only other thing it could be would be tails. All right? So the idea here, the idea here is that math.random will return a number between one and zero. So half the time, it'll be less than 0.5. And the other half, it'll be 0.5 or greater. Right, so one half it will be less than 0.5. The other half will be 0.5 or greater Right now the the the reason why people are saying like do we need the equals is It's very specific. It goes from 0 to 1 but it's not inclusive of 1 Right, so it's not inclusive of 1 So since it's not inclusive of 1 we don't have to do the less than or equal to it's between 0 and 1 but doesn't include one. Yeah. That's why we can just do less than 0.5. Cool. I think this should work. Looks good to me.

Let's go ahead and call it. So let's throw it in a console log because it's a return, right? Since this is a return, if we just called it, it would poof in the thin air. I see the stretch. I got you. Let's see if this works. And then I got you, Nimog. All right. Let's go ahead and do this heads or tails. We're gonna call it and we're gonna call it inside the console log. Let's go back. Let's refresh. We got some others that have to run first. Boom, boom. And we got tails.

Nice, let's refresh the page. Boom, we got heads. All right, so we know we're getting heads and tails. That worked beautifully. Couldn't have planned it better myself. All right. Cool. So, let's go ahead and do this last one. First tree. And we have a stretch. Nemog777, thank you for the stretch. I'm gonna do a real stretch. And you know, if you really wanna see me stretching, there's only one way you can get that type of content. So, one second. Oh, that's the type of content you're missing folks, only a million channel points.

Come on. What's a million channel points? Only a million channel points. And you get that lovely, lovely content. All right. Somebody said, how can we test this? Know if it really works? Well, eventually we're gonna get into testing our JavaScript. We're gonna write test cases. So if you've been doing your Code Wars, you'll notice that Code Wars enables you to write test cases, right? And so we could write test cases to see if this works or not, and we could run a bunch of them. So eventually we'll get to testing later on in program towards the end, but that's one way we can test to make sure this stuff really does work and make sure it is like functioning heads or tails. Yeah. Alrighty, last one here. Create a function that takes in a number.

Console log the result of heads or tails using the previous function x times where x is the number passed into the function called the function. All right, hold on, let me read this again. Create a function that takes in a number. I know I write these but still sometimes I forget what I write create a function that takes in a number Console log the result of heads or tails. So we're just gonna we're just gonna run the heads or tails function again X times or X is the number passed into the function So all we're gonna do is we're just gonna we're just going to run the heads or tails multiple times And just result and console log the result. So I'm just gonna console I'm just gonna comment that out. So we don't actually have that running up here and And let's go ahead and set this up. Function, we're gonna call this, I think last time I called it, what did I call it last time? Yeah, flip, flip, flip, flip, flipadelphia. There we go. So we're gonna call this flip, flip, flipadelphia. And this is gonna be our function to flip a certain number of times. So it said X times, So we're just gonna put in here the number of times, right? So I'm just gonna use n, which is short for the number of times that we want this to run. And then we can set up a really simple for loop.

So for let i equal one, I'll start counting at one, while i is less than, and we'll say including that number. And one of the mistakes we've made in the past is where we forgot to include the equals because we wanna go from one including that number. So we'll say n and then we'll do I plus plus Okay, and then we're gonna have result Result equal and we're just gonna call this function heads or tails Cool so what we're gonna do is we're gonna call this heads or tails function each time the loop runs And the cool thing is that this heads or tails function is already set up to return heads and already set up to return tails. So I actually don't need to do anything special other than console logging the result. All right, so this should work. Let's test it out. It's actually kind of hard to see this all on one line, but I think I'm actually gonna do this function in one line. I think we'll come back and do this in one line because I'm kind of having a hard time getting them both on the page. Let's see if this works. Let's go ahead and call it. Flip, flip Adelphia. And we're gonna do this 10 times. We should see 10 results. We should see 10 like mixing of heads and tails. All right, let's go back.

Let's refresh. Errors 58. All right, so we got two heads, two tails, and then five more heads and a tail. So this did run 10 times And it was it was definitely definitely felt heads more than tails. And so what we can do, let's make sure this runs one time Let's make sure this runs one time, let's see and Let's refresh Boom boom boom. Alright, so it does run one time So what we can do is we can YOLO some channel points right now folks. This is this is what we did We just we just built ourselves a gambling machine So let's yellow some channel points some of you some of you want to get that sweet sweet sweet OF content But you need more points so tonight's the night tonight's the night folks. Let's go ahead Start a prediction Start a prediction we're gonna say Heads Heads or tails. And the first outcome will be heads, and the second outcome will be tails. You have a minute to get in here, and I'm starting it now. All right, so you can join the prediction, heads or tails, you can risk as many channel points as you want, and then we're gonna run, we're gonna refresh the page, and whatever it says, that's who wins. All right, let's see how many people, how many channel points people are throwing up on this. You only got a minute to get in here, folks. Ooh, 280,000 channel points on heads right now. Ooh, 400 to 600, 300.

Oh, we might hit it. We might hit a thousand. We might hit a million channel points. Oh yeah. We're, we're, we're, we're way over a million channel points up for risk here. Folks way over a million. Oh no. What did I, what did I unlock in all of you? Oh no. Oh no. 1.3 million to 1.2 million. All in baby. Let's go. All right, let's do it for all of the channel points. Let's see what we get.

All right. Let's refresh the page. All right. We got our ers. We got our 58. You ready? Tails has it got it. Let's see. Let me, let me confirm the prediction. Choose outcome. 51% of you said tails. So 1.5 million up against 1.4 million. Now let's choose outcome. It was tails. And we're gonna complete the prediction.

All right. So you should have gotten your channel points there. The prediction result was tails. Oh boy. Hold on, let's see the details of this one. It was 50-50 in the end. I think the most channel points risked was 49,000. 2,000 channel points by Honda Civic so Honda Civic risks 49 K and what the come-up is Dangerously close to being over a hundred K Wow Wow congrats Honda that was that was wild. Oh No, we got we got some big ones coming in, let's see People ready to splash out with their channel points. Now, uh, MX with the hydration cheers to you, uh, Pokemon card. And Yuri, I'll get those at the end. And then, um, Diego splashed out with guide the raid. Uh, so Diego, send me a whisper with the person you want us to raid in The software and game dev category has to be in the game software and game dev category Uh, send me a whisper and that's who will raid Cool has to be in the software and game dev category. We don't rate anybody else Double or nothing. I don't want to I don't want to unlock that and and some individuals We'll run it back.

Maybe later. Maybe after our next break I want to take a look at this though before before we move on Before we move on Let's go ahead and, let's go ahead and take, let's take a look at this right here. How could I do, how could I do this maybe like all on like one line? Like I like this function, but we learned some things in the past. We saw some arrow functions and we know how to do ternaries exactly. So let's let's see if we can combine our arrow functions and turn it. I'm going to comment this out I'm going to say const Heads or tails and i'm going to set it equal to Are we taking in anything? Are we taking in anything Nah So we can go ahead and then do, let's go ahead and do, what's our math.random, right, math.random less than 0.5, right, less than 0.5. And we're going to say if it is less than 0.5, we return heads. and if it's greater than 0.5, we return tails. Let's see, let's see if this works. Let's see if this works. Let's see if we still get a result. Let's come back. Let's refresh.

Boom, boom. All right, still working. We got the tails. All right, so let's talk about this. So for me, this is all in one line, which is beautiful. We got, not tails again, it's rigged. So that's the thing, this is the beauty. This is high stakes. This would be like, I feel like we need to do this. I feel like we need to do a day where we just risk channel points. This won't work out in my favor because we'll hit the only fans. Where we risk channel points But the code could be right or wrong so not only are you like you're trying to like Like risk your points, but like the code might be wrong and it might favor Someone else dab. I think we need to do this dab I think me and you need to do like a like a game show Where we write out code and we're either like with chat or against chat We're like we're throwing in bugs or not throwing in bugs and we risk our channel points. I think that'd be really fun Let's keep that. Let's see if we can make that happen All right, so what's going on here is, we set up an arrow function, and there's two key things about the arrow function.

A lot of folks are saying, what about parentheses? Well, you only really need parentheses if you know you're gonna have multiple parameters. So you really need the parentheses when you're doing multiple parameters, like X and I or something like that, right? Right, X and I, right? That's what we could do there, right? We could do X or I, right? We could do just empty parentheses, that's pretty common, right? That's pretty common, right? That's pretty common. But it was all a bamboozle, because you can also do like, I just do this underscore, right? I do this underscore just to say like, hey, I'm not passing in anything, right? I'm just passing in anything, right? Like, I'm not passing in anything, So I put the underscore for me when I don't pass in anything. I just do an underscore and that's for me and For the other developers I work with to know like hey, like I'm not I'm not passing anything in it's just empty You can put any character there you want it, but I just do the underscore to say like hey I'm not passing it in anything and this is a preference that you'll see come up again as we get further into JavaScript And then just the the arrow and then there's something wrong with this code This code ran It gave us a result, but there's something wrong While y'all were working on the parentheses over here, the real parentheses we were missing were here. There we go.

So now I'll actually do random, cause random's a method and I forgot it, right? So second try. So here now, if we want this random method to run, we actually need the parentheses, right? it won't run without the parentheses. And so since this always fails, right? Since it always fails, we would always get tails. But now that we have the parentheses, this should work. And now we should get heads or tails. Cool. Good on y'all that noticed that, that was a good catch. Beautiful. All right. And it still works. Let's run it a few times just to make sure we're good. Heads, great.

So now we see that it's working beautiful. Ah, yes OCC also brought up the implicit return This is an implicit return. We don't need the return keyword Like we don't need the like we have the return keyword. We have the return keyword up here We don't need it with an arrow function because there's something called an implicit return. It just does the return for you Right. It just does the No bright side. That's why It just does the return for you. So what winds up happening is we're gonna call this heads or tails function. We check to see if it's less than 0.5, like the math.random gives us a number between zero and one. If it's less than 0.5, we implicitly return heads. If it's anything other than less than 0.5, we implicitly return tails. So that means down here, we're just returning heads or tails whenever we call it. Beautiful. Flip, flip, flip Adelphia. Yeah, there's nothing here telling it to console log.

It's down here where we're doing the console logging. Yeah, because we call this function here and what winds up happening is we wind up running this function each time the loop runs and the heads or tails gets returned to where the function is called. So we get heads returned here. We get tails returned here over and over again. Cool. Cool. Alrighty. This is one of those ones to come back with, play around with it, get into the muck with it. You'll kind of see these ternaries pop up here and there. But if you're like, I want to get better at this stuff here. There's one thing you can do that'll help you get better at like understanding and writing this kind of code. I didn't know how to write this code until I started doing something very specific. Yeah, that's Code Wars, exactly. I saw this pattern. I first saw this pattern probably on Code Wars, right?

I probably saw this on Code Wars. I incorporated, this is definitely in my Anki. Like this whole line is in my Anki. I incorporated it into my Anki and now I can recall it with pretty good precision pretty quickly. Can I explain it in a pseudocode kind of way? Well, it's just that we have a function. We have a math.random where it returns a zero between zero and one. And so if whatever value comes here is less than 0.5, that winds up being a true statement. And whenever you have a true statement on the left-hand side of a ternary, you automatically grab the heads. It's the, sorry, you grab the left-hand side. So you would grab heads in this case. If, for whatever reason, this evaluates to false, you would grab what's on the right-hand side of the colon. It's the same thing as the conditional here. Don't let it, don't let the ternary scare you. This is the exact same thing as having an if and an else.

This is the, if the if is true, and this is the else if it wasn't. That's all. What's an Anki? Anki is our space repetition tool that we use. It's kind of like flashcards with an algorithm behind it. If this is your first class with us, our very first class on YouTube, you can do exclamation point YouTube covers Anki and why you'd want to use it. Cool, all right, let's move on, folks. We talked about arrays, talked about arrays a lot. This last two classes, chat, what are arrays? I still don't get the underscore. It's just a, it's just a, it's just a parameter. Instead of doing like X or I, cause I'm not going to use it. I just do underscore and that just lets me know, Hey, this is like empty. I'm not going to use this at all. We could have put an X there.

We could have put an I there. It could have been any other. We could have just put empty parentheses, but since I don't actually need a parameter there, I do the underscore. Yeah, raise our toasters, exactly. And when we say a toaster, what we really mean is an element that can store other elements, right? A data structure that can hold other things. And so we like to think of Bill Gates toaster, where it can hold a bunch of stuff and every single time it needs to add something new, it gets a new slot and a new slot and a new slot. Some tricky things with arrays is that they start, they're counting or index with what? Zero, exactly, exactly. There are two different ways to create arrays. There's this constructor way, which we'll actually start using probably on Thursday or Tuesday, because we'll understand how them use constructors when it comes to objects. But the way we've been using it so far is using literal notation, using square brackets, where we literally create an array. When we create an array, we can put elements inside of the array. And we also have the ability to pull stuff out or put stuff into an array using its index 0, 1, 2 or 3. If you're new, this is all stuff that we're doing a review.

That's why we're going through it kind of quickly. We have two or three classes that you can find here on Twitch and then on YouTube that go through this in detail. Alrighty, so here's us grabbing stuff out of the array using its index. New array zero gives us zebra. New array one gives us undefined, why? Agent Hanzo A, thank you for the hydration. Cheers to you. It's empty, exactly. There's nothing in this space, right? There's nothing in this space. So we get undefined. And then we grab the element and the second index. So zero, one, two. So we get true. And then here's us grabbing the element in the third index.

Zero, one, two, three. We get 21, 21, 21, 21. Beautiful. We can also put stuff into an array using the index. So here I'm grabbing that undefined space and plopping the string of Bob into it. The spaces don't have to be empty for us to put stuff in. We could have just have easily changed this to zero and override zebra to be Bob. The tricky thing is that we can actually overwrite whole arrays with arrays. And so you can overwrite a whole array by assigning an array to a different array. So here we have two arrays, cars and nums. We set cars equal to nums. If we ask for cars, we get one, two, three. We can also get the length off of an array and keep that in the back of your brain. We can get the length of an array because we're gonna get the objects later today and we're gonna have to come back to this. So we can get the length of an array and it'll tell us how many elements are in that array.

And the tricky thing is that it counts starting at one. So the index has started zero, but the length starts at one. All right. We can also iterate through arrays where we're trying to pull each value out of an array. We saw a simple way of using a for loop, right? With a for loop, we can just kind of grab a number and count from zero to some number. And we can use that number to pull values out of the array. So I start my increment of i at zero. And that's because the very first time I want this to run, right? The very first time I want this to run. Ooh, that's such a good question. Mohammed asked a super good question. Why does length not have parentheses at the end? Oh, hold on. Just hold, that's such a beautiful question.

We're gonna get there today. I will answer that question by the end of today. What a good question. All right, we start our count at zero. Chat's blowing it up, but yes. We're starting our count at zero, So we can use the index best colors zero would give us green then one we give us blue Two we give us yellow three would give us black We can also use methods that are built in with arrays to help us right? To help us loop through our content. So for each is a goblin that runs And each time it runs it grabs the element its index and the actual array that it comes from and passes it in to this function. What kind of function is this? What we call this, what kind of function is this? Yeah, it's an arrow function. So in previous time, we would have used anonymous functions, just functions without a name, because we're passing a function into a function. We don't need all that declaration syntax or any of that stuff. if we don't need the function keyword because we're passing it in as a what? We're passing it in as a what?

As an argument, exactly. Yep, we're passing it as an argument. Beautiful. All right. We also saw some wonderful methods that came with arrays other than for each. We saw shift, pop, unshift. We saw all these wonderful methods. So let's run through them again. So here we have an array. Best wrappers 2020 on that list. We have 6.9, Polo G, and 6.9. Pretty quickly, we shift off 6.9. And so what it does is it takes the beginning of the array and pulls it off. If you were to just do shift, you could grab that first value off and it would poof, evaporate into the ether. but we've actually stored it in a variable called removed.

And so right now, 69 is pulled off and it's stored in the variable removed. However, if we ask for best wrappers 2020, we can see that the array has changed and no longer has that first 69, it's just poloG and 69 on the right-hand side, right? So we shift, shift takes the first thing off of an array and pulls it off. Next, we learned how to pop. So when we pop, we take the value that's at the end of the array, and we take that off. So shift is off the front, pop is off the end. And so when we ask for best wrappers 2020, we wind up with is just polo G at the moment, right? Just polo G at the moment. Because we've already shifted six nine off, We've shifted the other six nine off. Sorry. We've popped the other six nine off and we just have polo G left Pop lock and drop it a a hold on Yeah, you don't know about that, huh, I don't know about that, huh, all right, I see you I don't know you don't know Huh? Learn something new today. All right, so we're left with just polo g because we we shifted off And we popped off beautiful Now We can actually do the almost kind of opposite right we can unshift which is putting something on the front So here I had just polo g And I unshifted dylon. So now dylon is on the front of best rappers 2020 And we can do the same on the other side. We can push Dylon onto the back of the array.

So now when we look, we have Dylon, Polo G, and Dylon. RKMaseA, thank you for the gift of subs. Thank you for being here. Beautiful. So now we have in the best wrappers 2020, we have Dylon, Polo G, and Dylon because we shifted off and popped off six, nine, and then we unshift it and push Dylon. Beautiful. Now the last method that we saw was map. And map is gonna run once for each element in the array. But map does one very specific thing. What does map do? What makes map different? Like what does it do? We have more viewers than Timberland. Timberland's streaming, that's wild. What about the Timberland?

It returns a brand new array. Exactly. Returns a brand new array. Wonderful. So if we are gonna run once for each element in the array, does map do anything? What's the only thing that map returns? This is an implicit, this is, right, Timberland, this is an implicit return, right? So the only thing this map is doing is returning what? The only thing this does is it returns Dylon. So if we know that this map is gonna run three times, what we're really doing is creating a new array for best wrappers of all time that has Dylon in it. That's the first time it runs. Then it's gonna grab Polo G, but it doesn't do anything with it. It just returns Dylon. And then it's gonna run a third time. it doesn't even matter that it was Dylon, it still just returns Dylon.

So the only thing that a map does is spit the hot fire, right? And so here we wind up with best wrappers of all time, just being Dylon, Dylon, Dylon. And then for the last, the last two things to add here, we unshift Dylon onto the front and we push Dylon onto the back. And so when we console log the best wrappers of all time, we have Dylon, Dylon, Dylon, Dylon, and Dylon. Beautiful. Alrighty, folks. We have another review to do, but since we're at the top of the hour, let's take our break. Let's take our break. Let's put five minutes on the clock here, folks. Five minutes on the clock. We're new around here, we like to be healthy, we like to take our break, pull in air, add it two minutes to the timer. Let's go ahead and this is now a seven minute break timer, beautiful. Let's go ahead, we're going to take a seven minute break. That hour went fast, it sure did. And when we come back, we're going to do a review and then we get to objects, folks.

I'm super excited to get the objects. All right, so let's go and take some minutes on the clock If you're able to please get up and move around I'm gonna run the ad so new folks don't have to worry about it Decent You You 45 seconds left. Do you know the total salary of the hundred devs who got jobs were over 4 million. I got to add some new folks, but we're over 4 million. Now I'm going to start releasing like what I know about all the folks. So we'll release kind of like the stats and stuff like that. But yeah, we're over 4 mil. All right, folks, come on back. Come on back. All righty, all right folks, come on back, come on back. Let's go ahead and take a look at this review and then we're going to jump into objects. So it's the alien rangers review Go ahead and open that up We have three questions here and i'm gonna go ahead and put let's put five minutes on the timer five minutes on the timer Give it your best shot and then we'll go over it together Can we petition them to change unshift to add to front yes, I think it'd be a good petition Alright five minutes Go at it you have it and we'll go over it together You got this folks again Hey, glad to hear it, Phillip. Best DC superhero, does vertigo get put into that? Um, I mean it's Batman, like, why am I gonna front, I ain't gonna be like, oh, let me impress you with my vast comic book knowledge, nah, it's gonna be Batman. All right, folks, three minutes, 30 seconds.

You got this dig deep. I haven't seen new one yet. I'm still afraid to go to movie theaters soon. What's your favorite Megazord? Now we're talking. Um, I mean the most nostalgia is definitely the, the mighty Morphin, right? You can't beat that like symbol of your childhood. I think when they got to lightspeed rescue they did some more interesting stuff like graphically But I have to say Mighty Morphin Ninja Storm was pretty cool, yeah I know party wounds, that's true. Two minutes, two minutes. Yeah, the assembly sequence was pretty lit. Do you watch any K drama? No, I have not ever really got into it. I have a feeling that if I did start, it'd be a, it'd be a problem for me. So how do you all remember this from your childhood? I watched power rangers, but I don't remember this stuff because I watch it as an adult I love power rangers uh I kind of like stop like anything like after dino thunder is like too much for me, but Anything like pre dino thunder i've probably watched all the way through like as as an adult The second lowest mean including or excluding it would it would be including I guess for this example got some fun some folks coming with the dunzo it's got a few folks that got Something the last one that's okay.

We're gonna go over it together All righty 30 seconds left got some dunces rolling in I Always wanted that green dagger toy. I mean I've been um, I was I'm I I don't know why I'm telling people this. I've been 3D printing different swords and that's on my list. I just did some test prints earlier to get a collapsible lightsaber. But yeah, I'm doing a bunch of different like, like toy swords. Because I print like, I like to print a lot of like, I guess it would be like toy stuff, But it's been fun. I have my Bulbasaur right here. I print it, which I really liked. Yeah, that came out clean. It's pretty good. To me, a 3D printer is like the best, the best toy you could ever give a kid because you can get printers now. Like I know $200 is nothing to slouch about, but for like less than like a, I don't know, like less than like a gaming console, they can build whatever toy they want. Like the plastic's like $10. And then for like half of a gaming console, they can build whatever toy they ever want. And they're all like free online.

Yeah, that's pretty dope to me. All right, folks, come on back, come on back. Let's go over this together. Yeah. Yeah, I use my 3D printer for D&D too. Like I have a bunch of miniatures that I've printed off. That was pretty cool There was a humble bundle that had a lot of like really good miniatures in it, and I've been using those First one done a killer. That's awesome. Congrats. All right, let's come on back. Let's go through it We're pretty use I have an ender 3v2 I have the BL touch mod on it a new hot end some other like fancy stuff glass plate, but not too many mods I'm putting OctoPrint on it today. Well, hopefully this week. Yeah. Anyone else mutely on during the timers? Yes, I hope you do.

Some folks like the complete silence, some don't. So I like to just keep talking because I think some folks just prefer that in the background, but always feel free to mute me. That's why I leave the timer up, right? The timer I leave up. So if you don't want to hear me blab on, you can just mute me and then see the timer go off and come on back. All righty, create an array of TV shows, loop through, and print each show to the console. So let's go ahead and we're just gonna start off by putting our, we'll just use the same shows we did last time, let's do Power Rangers. So let Power Rangers equal, and then we're gonna go ahead and do Mighty Morphin. Here's my thing about Power Rangers though, They they they had new Power Rangers movie, but they didn't do it, right? The way you do hold on the way you do a modern Power Rangers movie is thus, you know, Cloverfield Right Cloverfield was like dark and they're like on a roof It's a bunch of like teenagers hanging out right and then like something starts to attack. You don't know what's attacking But it's just like these like cool kids hanging out. It's really dark It's gritty if you had gone to Cloverfield having no idea what it was and they're just like these older teenagers hanging out on A roof someone starts attacking and they all just go it's morphin time You would have lost your absolute like you would have lost your mind, right? Like you just would have been it would have it would have blown your mind. That's how you do a new Power Rangers movie You don't tell anyone. It's a Power Rangers movie You just let some shit go down and then right as it's about to get really bad.

We just even go Morphine time and then like everyone like If I see that's the shit out if I was a billionaire as the shit I would do No build-up no hype you're going there for something completely different and then your mind just blown that it's a Power Rangers movie That's how you do it. All right, Mighty Morphin We'll say alien Rangers I spell it right, Alien Rangers. And then we'll say Neo, beautiful. Now we have our TV shows. Loop through and print each one to the console. So what type of loops could we use here? What kind of loops could we use here? We can use a for loop, just like a generic for loop. We can use a for each. Let's use a for each, because we want to get some practice in. Let's go ahead and do Power Rangers, and we'll do for each, and then we're gonna take in each value. So we'll just say, show, and we will, we're gonna print each one to the console, so we'll just console log, dot log each show. And so what this is going to do, is we're gonna run once for each element in the array. So we have one, two, three elements in the array. So this for each will run three times.

Each time it's gonna run, it's gonna be the goblin. It's gonna run and grab Mighty Morphin and then plug it into show. Then it's gonna grab alien rangers and plug it into show. And then it's gonna grab Neo and plug it into show. I'm saying Neo instead of Zio, is it Zio or? Yeah, I keep saying Neo. I don't know why I keep saying Neo, it's Zio. Oh, could you imagine, right? And so what winds up happening is that Mighty Morphin gets console logged, then Alien Rangers gets console logged, and then Zeo gets console logged, right? Beautiful. I did just watch the matrix, yeah, that's why. Alrighty, let's save this and let's make sure this John actually runs. Good let's open this in the browser Look at that that's so fire. This is why alien rangers are the best look at this I'd wear that right now. Y'all.

Give me this black fit. It's over Kanye might have changed his life, but i'm still an old school gemini. Look at that fire here. All right. Let's refresh. We don't actually have anything printing to the console. Let's go back and take a look. Why did nothing print to the console? We didn't save so now we can come back and refresh second try we got mighty morphin we We got alien rangers and we got a zeal. That's the second layer of the stream is I just say a lot of stuff. And if you know, you know, but most of the time it's just rap lyrics. So a lot of stuff I say is like not actually true. It's just rap lyrics. So if you're in, you're in, if you're out, you're out. I don't know.

I can't help you there. Alrighty. Quick maths indeed. Return a new array of numbers that includes every even number from the previous array. So, oh, sorry. We have to create an array of numbers. Then we have a second prompt here. So let's go and create an array of numbers. Let nums equal, and let's just throw some, give me some numbers. Chat, can you give me some numbers, please? 21, of course. 56. 88. 24. 99 and 710.

Cool, all right, thank you for those numbers. All right, let's return a new array of number, return a new array of numbers that includes every even number from the previous arrays. So only a new array that only has even numbers. So let's go ahead and let's just do this This is like an arrow function, let only evens equal. And then we know we're gonna pass in an array. We're passing in an array. And that array, we wanna get just the even numbers. So did anybody know something we can do to get only even numbers? Is there like a method or something that we could use? Yeah, we can use a filter method with modulus. So let's try the filter method. So we'll do array.filter. And the cool thing about filter is it runs once for each element in the array, and it checks to see if something is true. If it is true, it includes it in that new array. So let's go ahead and take a look at it.

So we can filter. We said we're gonna do, excuse me, let's go ahead and say array filter, we're gonna take in a value num, and we'll say while num is modulus two, if that equals zero, so that equals zero, then we know that it's true. That should work. Like if the number modulus two, all right, let's see where I'm at with this one real quick. Let well, sorry, let's console log. Don't worry. I'm gonna come back to let me let me see where I'm at console log only evens and Let's pass in nums Alright, let's see where we're at. I mean, let me add some space sitting here so people can see what we're doing Let's save this All right, and let's refresh Cool, so we have an array that got console logged that has 56, 88, 24, and 710 in it. First try, and so that was only the even numbers that were in that nums array. So let's take a look and see where this comes from. So here's our nums array, and here we have a function called only, Evens only evens here. We have an arrow function What I am doing is I am going to this is going to be a function that will work with any Array, right? It'll work with any array. And so I know I'm gonna pass in an array. So I named my parameter Array, right?

I named my parameter array Then I run the filter method on that array It's the same thing as running the map that we had, right? Like the map we had before, it filters just another method built into JavaScript that can do some heavy lifting for us. What the filter will do is it's gonna help us set up a new array. Just like map sets up a new array, filter set up a new array. And to add a value to this new array, this statement winds up having to be true. So if it's not true, we don't add that value to the array. So the very first time this runs, we are filtering through nums, because nums is the array that we pass in. We call only evens and we pass in nums. So wherever we see array, array is nums. So that means array right now is holding the 21, 56, 86, 88, 24, 99, and the 710. So how many times is this filter going to run? How many times is this filter going to run? Just like math would run multiple times, how many times is the filter going to run? Yes, the filter's gonna run six times. There are six numbers in the array, right?

There are six elements in the array. So this filter is gonna run six times. Now, the very first time it runs, what is n the very first time? 21, 21, 21, 21, 21. All right, so does 21 modulus two equal zero? No, 21 is not an even number. Two does not go into it evenly, so that's a false. So do we add 21 to our new array? Nope, all right. Next, we're gonna try 56. Wherever I see N, it's actually 56. Does 56 mod two equal zero? Yep, so then we add 56 to our new array and we get a new n. Now it's 88. Does 88 mod two equal zero?

Yep, so we add 88 to our new array. Then we try 24. Is 24 mod two equal to zero? Yes, so we add 24. Now, is 99 mod two equal to zero? No, two does not go into 99 evenly, so do we add it to our array? Nope, we do not add it to our array. And then the very last time this runs, n is 710. Is 710 modulus two equal to zero? Yes, two goes into 710 evenly. And so we add 710 to our new array. Now, the funny thing is this new array, what happens to this new array? Look right here. Talked about this earlier. This new array is created right here.

What do we wind up doing with the new array that we just created? There's something very specific that's gonna happen here. There's something that when we use the arrow functions that happens. Yeah. It's an implicit return. So that means that the new array that we just created, boop, it gets returned to where it's called. So it's as though only evens was not here, but our new array holding 56, 88, 24, and 710. And that gets put into the new array. And that's what gets console logged. Right? So the beauty here is that the filter is going to create a new array for us. And then whenever it's done creating that new array, it gets returned to where it was called. And that's why we see the new array being console logged. What does the end mean? It's just a parameter.

Just like array is a parameter. They're just parameters. We could have called them anything. We could have called it robot and unicorn and it wouldn't have mattered. Cool. If this is tripping you up, don't worry. This is like the first time we're seeing arrow functions in the wild. Come on Sunday and we'll redo some problems like this where we'll do it without arrow functions and with arrow functions so we can see both ways. Cool. Last one here. Create a function that takes in an array of numbers. Right? Create a function that takes in an array of numbers. Alert the sum of the second lowest and the second highest number. So we already have nums.

So let's just use, well, it says create a function, let's create a function. Let's start there. function sum of the second and highest lowest. So we're gonna do sum second low and high. There we go. So we know we're gonna take in an array of numbers. So I'm just gonna call our parameter array. And we're going to return the sum of the second lowest and the second highest. Now, if I wanna make my life easy, if I wanna make my life easy, right? If I wanna make my life easy, how can I get my numbers in a way that I could grab the second highest and the second lowest? Yeah, I could just sort them. If I just sort them, if I just sort them, then I can just use the indexes, right? I can just go one in and two from the end and grab them and I should be good. So I see your stretch, Winchy. I got you after, let's do this real quick.

So let's call, let's sort it equal. And all I'm going to do is sort the array, array.sort. and then I'm gonna take in A and B, and boop, A minus B. This is how you sort numbers in an array. Now, let me ask you, how do you think I was able to bang that out so quickly? Is it something that I just implicitly knew because I am a elite developer? No. This is something that I learned way back in the day from coding challenges, probably from Code Wars, right? This sorting is something that I had to figure out how to do to solve a Code Wars. And then once I learned it for the Code Wars, I added it to my Anki deck and this pops up once every, I don't know, year or so, because I've seen it so many times, Right, but it's not something that I would know just because like I know how to code. It's something that I Researched to solve a code wars. I said hey this sorting thing is probably really really beneficial I added it to my Anki deck and I review it constantly So when I do see this problem will come up again This pattern comes up where I have to to to get numbers in a certain order boom Sort it and call it a day. So hint hint hint hint hint hint hint add these things to your Anki deck We've showed a lot of stuff today. That should definitely be in your Anki We saw a filter for that really the first time we saw a for each again We're seeing a sort These are things that you need to come back to you need to spend some time with these Outside of class to see how they work to see how they how that how like you break them down The reading and the videos also work through a lot of this stuff as well. So it all kind of comes together to see it, but it definitely needs to be in your Anki.

When I add it to my Anki, how is it? It's just this. How do you sort an array of numbers? And on this other side would be this, literally this exact code. Cool, so now we have sorted numbers and we want to alert the sum. So we know we're going to wind up adding two numbers. Now that my numbers are sorted, how can I get the second lowest number? What's happening with the A and B, it really doesn't matter. This is just how you sort from low to high in JavaScript. You can reverse the B and A and go from high to low. That's kind of what's happening. It's just the specific way that we're sorting. Once we get to our data structures and algorithms at the end of the cohort, we'll really break down what's happening inside this sort function to need the A and B. But at this point, you really don't need to know what's happening inside the sort function because we're not trying to write super efficient code yet. But when we get to our data structures and algorithms and then the course, we'll break that down.

Cool. Our numbers are sorted, right? There's a lot of weird things that we could do. I'm seeing some folks pop. Some folks are saying pop the min and max. And then you're left with like easier numbers. I'm seeing some splicing and some slicing and stuff like that. But we know that the lowest number would be array what? What index would be the lowest number? Yeah, array zero would be the lowest number. So the highest number, the highest number has to be, sorry, the second lowest, if the lowest number is index zero, the second lowest would be what? One, exactly. So we know the second lowest would be one because the lowest is zero. And we're gonna add that to the second highest. So we've seen this before where we do array and we do array.length minus what would give us the highest number, right?

What would give us, sorry, yes, it's sorted, not array. Good call, good call. It's sorted. Sorted is our sorted array. Whoops, good eye, thank you for that. Beautiful, because we're dealing with our sorted array, so not our original array. So if we wanted to get the highest number, it'd be minus one, but we want the second highest, so it'll be minus two. And then let's go ahead and call this function and pass in some numbers. So we're gonna sum second low and high and let's pass in some numbers. Let's pass in, let's just do, let's do one, two, three, four, and five, but let's mix them. Two, three, four, one. Let's do one, five, four. There we go. So we have one, two, three, four, and five all mixed up. And so if we want the second highest and lowest, is we should see two and four be added together for six.

So if this works, we should have six. So let's save this. Let's go back. I should have my sword printed already. It's on fire. Add that sword up there. Oh, that would have been legit. All right. Anyway, let's refresh. And we can see the six gets alerted, right? So it worked. The two and the four got added together. We got the six alerted. Beautiful. All right.

So we saw some sorting. We used the knowledge of our indexes to grab the second lowest and the second highest. We added them together and then we alerted them. Beautiful. Thank you, Enlightened. That's beautiful to hear. Brooke, that's awesome to hear. Cool. All right. Now, I owe a stretch. So let me do my stretch. You know, if you want that good, good content, you gotta start YOLOing some more channel points to get the O.F. Run second. Alrighty folks, we got through some review. If you want to see more, if you want to see more of these types of practices where we're using more methods, we're using arrow functions, we're starting to like do things in slightly different ways, and you want to see me review it with regular functions and then try it with the arrow functions.

Come Sunday. Sunday we're going to do some questions like always, but we're going to spend a lot of time with methods, so if you want to come back and see these methods, you want to see more arrow functions. Let's do that review on Sunday together. Hippie Sue, hey, thank you for the five gifted subs. Thank you for being here. Alrighty, let's get to the goods today, folks. The goods are objects. So, objects are really the last puzzle piece that we need to kind of start building some really dope stuff. Once we understand objects, your mind, you become enlightened in terms of JavaScript. There's going to be, we're going to set some things up today, and then I am literally going to blow your mind on Thursday. Like your mind will be obliterated on Thursday in the best way possible. So we're going to touch on objects right now, get the juices flowing, and then come Thursday, just mind explosion. So let's get into it. The wonderful thing about JavaScript is that every single thing is a what? Is an object.

Keep that thought in your mind. Every single thing is an object. Keep that in your mind. What objects are are collections of variables and functions. If you look at an object, all it really is is a collection of variables and functions, just like the variables and functions that we've already seen. And these variables and functions, they represent the attributes and the behavior of that object. Now, when we're talking about objects, we call the attributes properties and we call those functions, we call those methods. So the variables we call, sorry, the variables we call properties and the functions we call methods. The attributes we would call our properties and the behaviors we would call our methods. And so at first it's kind of hard to wrap our brain around. So let's think of an actual physical object, like something that we could really think of, right? For me right now, I am thinking of my water bottle. So I have a nice Nalgene bottle here full of delicious ice water, one second. Now this water bottle has some attributes and behaviors. It has some properties and some methods.

What is an attribute of this water bottle? It has a lid color of black. It has a full property of 50%, well, 60%. It has a shape property of cylinder. it has a brand of Nalgene, right? So we can think of all these different physical attributes that describe this water bottle, right? Not only its shape and color, but also kind of like how full it is, like all the different things we could use to describe the attributes of this water bottle. Now, what are some of the behaviors of this water bottle? What's something that it can do? It can open, right? Make you pee. It can open and close, open and close. So there are attributes that describe this water bottle, but there are also behaviors that describe this water bottle like opening and closing. Beautiful. Let's continue this train of thought with an object that we can all think about and let's think about a stopwatch.

What are some attributes of this stopwatch? This is a physical object that has some attributes. What are some attributes of this stopwatch? Now don't throw out the value. A lot of folks are throwing out the value. This has a color attribute that has a value of black. We want to say the attribute is black. We would say that the color. Attribute is black. How about the shape attribute? The shape attribute is around the brand attribute is AccuSplit. The model attribute is pro survivor. The minutes attribute is set to three. The seconds attribute is set to 59. Hey, thank you for the hype train everybody.

The milliseconds property or attribute is set to 45. So we can think about a physical stopwatch and think through all these attributes of this object. Yeah, it's shape, it's brand, it's color, all these different things that make up the physical attributes of this object. But a stopwatch also has some behaviors. What are some behaviors of this stopwatch? Yeah, it can start, it can stop, it can split, it can beep, right? So, there are a lot of behaviors that this stopwatch has. And so, when we think about physical objects, we can think about their attributes and we can think about their behaviors. And when we think about these objects, it's the same thing when it gets to code. Our objects in JavaScript are going to have some attributes and they're going to have some behaviors. When it comes to JavaScript objects, we call those attributes properties and we call those behaviors methods. And underneath the hood, our properties are really just variables. Color equals this, shape equals this. And our methods are really just functions, sets of instructions. So when you think of objects in terms of JavaScript, just think of regular old objects in regular meatspace.

They have properties and they have methods. You might have called them attributes and behaviors, but it's the same thing. When we look at the stopwatch, we can do the same exercise again. And we can say the color property is black. The brand property is AccuSplit. The minutes property is three. The seconds property is 59, right? And we can say that the actual methods that this stopwatch object has is start, stop, split, beep, all these wonderful things. Cool. So here is what that actually looks like. We can create a object using literal notation. Just like we saw literal notation with an array using square brackets, we can literally create an object using curly braces. And so here I have created a stopwatch object using literal notation, which means curly braces. Then right here, I have set up current time and current time is the first what on this stopwatch. Current time is a what.

We talked about objects having two things. So current time is the first what? Yeah, it's the first property, right? It's the first property. The current time property is set to 12. Next, if we look at stopwatch, you can see that we're setting up tell time. And without having to really know too much about our objects, we know that tell time is a what? It's not a property, it's something else. Yeah, it's a method. How do we know that tell time is a method? What's the dead giveaway that telltime is a method? It snitched on itself. Yeah, it's a function, right? Whenever you have an object and you're setting something about it to a function, dead stop, it's a method, right? As soon as you set telltime equal to a function, you have a method.

So right off the bat, we can see that our objects can have properties, like current time and methods like tell time a property is going to be some value and a tell time is going to be a value that is our method it's always going to be a value that is a function so if you're ever looking at an object and you see it set equal to a function you're going to call that a method anything else you're going to call it a property So the cool thing is we can use these properties and methods just like we would use any other variables and functions. And so once we have set up these properties and methods, we can start to use them. So here we have stopwatch.currentTime. Ignore this stuff here and ignore the parentheses. If If you're just looking at stopwatch.currentTime, what does that equal? Stopwatch.currentTime equals what? Yeah, equals 12. It's the same thing as slapping 12 in there because you can see we created our object and we gave it the current time property of 12. We can always ask for that property back from the stopwatch object by using this notation. Anybody know what kind of notation this is called? It has a very specific name. What type of notation is that? Did you get it from the reading? Yeah, it's called dot notation. We can use dot notation to add a property or add a method, but we can also use dot notation to consume.

We can get the current time, right? So right here, we know that stopwatch.currentTime is the same thing as grabbing 12. So wherever I see stopwatch.currentTime, it's the same thing as 12. Now, if we ignore this for a second, and we look at tellTime, how could we tell that tellTime was a method, even if we couldn't see it up here. In this instance, how could I tell that tellTime was a method even if I didn't see the function above? Yeah, exactly. tellTime has the parentheses, right? So if we were to write this out, stopWatch.tellTime, just the parentheses open and close, you can see that it has the parentheses. Whenever you see those parentheses, what is that? What is it? What are we trying to do? What are we trying to do? Exactly. We're trying to call. Whenever you see those, whenever you see those parentheses, is we're trying to make a function call.

And so if we're making a function call and it's tied to something else, right? It's tied to something else, right? If we're trying to make a function call and it's tied to stopwatch, right? It's no longer just a function, it's a what? If we're trying to make that function call and it's tied to the stopwatch object, it's no longer just a function, it's a what? It's a method, exactly. When our functions are tied to objects, we call them methods. And when we have individual variables tied to our objects, we call those properties. So here we can see a property tied to our stopwatch object, and we can see a tell time method tied to our stopwatch object. Now, Shadow said, can you use current time inside the function? Heck yes, we can. Let me show you why. Right? Right, we can for sure. So stopwatch that current time evaluates to what?

What does it evaluate to? It evaluates to 12. So what we wind up really doing is stopwatch we pass in 12, we pass in 12. So that means we're gonna pass 12 into tell time. So here's our function for tell time, that 12 gets passed in. Wherever I see time, I see 12. So console log, the current time is 12. And so that's how we can use the properties and the methods together, right? We can use the properties and methods together. We had one stopwatch object that came with a property and it came with a method. The property was the current time and the method was tell time. And we were able to use those together to start to do some cool stuff. we can run that telltime method and we can actually pass in the current time if we want. So objects are like customized methods. Well, you could think of objects having their own functions which can be customized and those are methods.

All right, let's go ahead and try writing some code to make this make a little bit more sense, right? Let's try writing some code to make this make a little bit more sense. Let's look at the objects Zio. So if we go to objects here, we have Zio. And in this object Zio, I want you to create a stopwatch object that has four properties and three methods, right? Create a stopwatch object that has four properties and three methods. I'm only gonna give you three minutes. Three minutes to try and bang this out. Look at the past slide if you need to. So three minutes, then we're gonna go over it together. Stopwatch object has four properties and three methods. Try it, even if it's not making sense. Look at the slide and use your good old 100 devs try to make it look the same here. Four properties, three methods. Three minutes, go for it.

Put the other slide up so folks can see it. Four properties, you can see adding a property here and the methods. Daddy's home 420 a thank you for the hydration cheers to you a Lot of this should have been review folks a lot of this should have been review this is this is in the reading Two minutes two minutes Uh, Diego, you haven't sent me a whisper, Diego. So if we don't have your whisper, I'm going to have to pick the raid All right, folks, 45 seconds. You got this. We got some duns coming in I like to see it All righty, eight seconds, we're gonna go over it together. We're gonna maybe slightly blow your mind just a little bit before we get to Thursday's class. All right, folks, come back, let's go over this together. All righty. So I wanted a stopwatch object. So the first thing I need to do Right. The first thing I need to do is create the stopwatch object. So I'm going to go ahead and do let stopwatch Equal and then my curly braces what type of notation did I just use? Right. What notation I just used to create the object Literal notation, exactly.

I literally created the object. On Thursday, we'll see constructors and some other fun stuff, ways to create objects. Beautiful. So let's add four properties. I'm gonna imagine like a Nike stopwatch. So I'm gonna go ahead and say stopwatch.brand equals Nike. Okay, then stopwatch.color, let's keep it the same as the picture, we'll say black. And then, actually I'm going to keep it lowercase so I don't get in trouble there. Stopwatch.what are some other properties that you all thought through? What are some other properties that you thought through? Shape, I like shape. Let's say shape equals round. And what else? Size, okay. Stopwatch.size, and we can set it equal to medium.

There we go, medium. We got our shape set to medium. And that's our four properties. And so the cool thing is, if we were to open this in the browser, right? If we were to open this in the browser, let's go ahead and open it. Let's go ahead and open it. All right, let's look in the inspector. Go to our console here. Oh, I failed to load the image. It failed to load the image. Why didn't the image work? Anyway, we can ask for this stopwatch, right? Since we're in the console, we can ask for stopwatch. So if we type in stopwatch, you can see that we get back the stopwatch that we just created, right? We get back the stopwatch we just created.

We have brand, color, shape, and size on the stopwatch that we created. So we can actually ask for stopwatch.brand and it would give us back Nike, right? We could ask for stopwatch.shape and get back round because we declared the variable stopwatch and literally created an object. And then we added the properties one by one. we could, if we wanted to, as we create the object, have done brand and then did Nike, right? Then we could have done color and do black. That's a little too much to get started with. So for what I did for now is I just literally declared my object and then I did them all on individual lines so that I could actually see it. But you could actually do it all, if you did the reading, it could all be done inside of the curly braces if you want it. But this is readable for now and we'll get to some other ways to do it later. All right, so we have our four properties and then let's go ahead and create the methods. So the ones that we kind of already said, I think I wanted to use. So let's go ahead and do start and I'm gonna set that equal to a what? If I want this to be a method, start has to be equal to what? Has to be equal to a function.

So I'll make this a function and we're going to say, just, we're just going to like console log starting. Starting. All right. Console log starting. Wonderful. And then we're going to go ahead and do stop. I'm going to do the same thing, equals function. And we're just going to console log. Stopping. Can you do it with an arrow function? You could, you could. Stopping, and then I want one more, which is beep. So, ooh, ooh, we could say, I like beep. Or let's make it say something, let it beep. Stopwatch.say, say brand, there we go.

And we'll set that equal to a function. And we'll console log. And what could I pass in here so that it says the brand? What could I do so that it says the brand? We could hard code it. We can just hard code it for right now. We could eventually get to something called like this, but that's a little too advanced for today. We can just say stopwatch.brand. Because we know that this right now, stopwatch.brand is Nike, right? So this would only work for this stopwatch, but eventually we'll get to this and it could be more interchangeable. All right, let's go ahead and save all this. We got our four properties. We got our three methods looks good to me. Let's come back. Look in the console.

Let's refresh So if we ask for stopwatch We can see everything that's stored in memory right now for stopwatch. We can see All of the brands the colors, but we can also see these other things in there What what what else have we added to this stopwatch object that the console can show us? What have we added? Yeah, we've added our methods. Exactly, we've added our methods. And so inside of the terminal, we can actually use these. We can do stopwatch.size and get back shmedium. But let's try running some of the methods. Stopwatch.start. If I just did this, something weird would happen. If I want my methods to run, what do I need? I want my methods to run. What do I need? I need my parentheses. So right now I don't have my parentheses.

So if I just hit enter, I get the function declaration back, right? I get the function declaration back, but it didn't actually run. It's just showing me what I have stored into memory, but it didn't actually run. If you want your methods to run, you have to use the parentheses. So boom, I hit enter now, and you can see it logged to the console starting, right? Logged the console starting and then we can also do the stay brand. So stopwatch That say brand and once again, if I want it to run I need my parentheses to make it a call Boom, you can see that it console logged the brand which was Nike. I looked at stopwatch That brand it was Nike. So this this method of say brand and actually, actually works. It said the brand that it was, which is Nike. Why does it say undefined? Because there was no return. It was expecting a return and I didn't have a return in my methods. Don't worry about it yet. Yeah, that's something we'll get to later on.

Cool. Alrighty. Cool, so we hit some things here. We have some properties that we can use on our objects and we have some methods that we can use on our objects. Matt, can I just, just give me a few seconds here. I just want to tease your brain just a little bit. Just a little bit and then third reason I'm going to like blow it. All right, if we look back at some of the stuff we did earlier today, like we all know, look at back some of the stuff we did earlier today. Let's um, let's look at this one that we just did recently Here I grabbed the length of sorted What is length look like right now based on what we just learned tonight about objects? What does length look like? It looks like a property but you're saying Leon sorted is a what though sorted is a what? Sorted is an array right here, but we're using length. Filter looks like a what? Let's get rid of stuff that's inside of here. Filter looks like a what?

A method, huh? But it's working on an array. Hmm. Hmm. We've been seeing these properties and these methods since the beginning. We saw math.min, math.max. We saw toString. We saw some of these methods and properties that we've been using this whole time. Interesting, I say. Interesting indeed. And that's because every single method thing in JavaScript is an object. Doesn't matter if it's an array, a string, whatever, anything we've seen so far, it's all been a lie. It's all been objects this whole time. So on Thursday, we'll make that mind bending idea come to life. We'll see how we can start to really use objects.

We're gonna peek underneath the JavaScript hood and see how everything really is objects. Alrighty folks, a huge thank you to everyone this evening. Hitting 100 jobs was a huge milestone, something I'm super proud of, and I'm super proud of this community every single day. You show up, you put in the work, you help others. Let's keep the positivity going. We're gonna go ahead and do a raid. The person that redeemed it didn't actually whisper me. So I didn't see that come through. So I've already queued up a different raid. Diego, we can do a different raid on Thursday if you want. But we're gonna go to Nick, who's doing a competitive data visualization. We've been there to them before, but they're doing something special today. Let's go ahead and give them some love. If you haven't given them a follow, they definitely deserve it. Go ahead and let's go ahead and set that up.

Beautiful. Alrighty, folks. Hope you had some fun reviewing Array, seeing some of our newer ways to handle things like arrow functions, some more methods. We're going to do more object practice on Thursday. Don't worry if this is your first time seeing objects. We'll get into it on Thursday. We'll have more fun. We'll make it make more sense. Thank you so much for 100 jobs. It means a lot. It means a lot that you're all here, that you continue to show up, continue to put in the hard work. We're just getting started, folks. Next week, best week ever. Let's raid.

End of Transcript