Web Programming with JavaScript I - First Edition | April Mintac Pineda | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Web Programming with JavaScript I - First Edition

teacher avatar April Mintac Pineda, Keep moving. Keep going.

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

16 Lessons (2h 53m)
    • 1. JS I 1 Intro

    • 2. JS I 2 Variables

    • 3. JS I 3 Constants

    • 4. JS I 4 Arrays

    • 5. JS I 5 Objects

    • 6. JS I 6 String, Number, Boolean

    • 7. JS I 7 if else if

    • 8. JS I 8 switch case

    • 9. JS I 9 While loop

    • 10. JS I 10 Do While loop

    • 11. JS I 11 For loop

    • 12. JS I 12 Function

    • 13. JS I 13 Function return

    • 14. JS I 14 Anonymous functions, function args, function ret

    • 15. JS I 15 Scope

    • 16. JS I 16 Reference error, syntax error, try catch, throw

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

This course will guide you from beginner to advanced in problem solving with JavaScript for the web. We will go into details of what you need to learn as a beginner and do exercises that will expose you to problems that will allow you to get to advanced levels.

Meet Your Teacher

Teacher Profile Image

April Mintac Pineda

Keep moving. Keep going.


Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. JS I 1 Intro: Hello, everyone. And welcome to this video on JavaScript Story one. This year's first video. We are going. I'm just going to introduce you to what you learn on this course. Absolutely are going to learn JavaScript, which once on the browser But before that, like you guys to be prepared. So I want you to install to download in store on That's Alodor, which I would recommend Adam text editor. It's very good, but it's this is what I have. This is what I use the ab Inpex editor. It's to my preferences, and I really love you have hospitalizations that seems, general, it's really, really good. I recommend it down and story. You're gonna need it for grabbing purposes. And, of course, I want you guys to go on your desktop and guess. Wait. A folder there called JavaScript. This is going to be our working directory. This is where our files will be stored. And this is where we will be working askew. JavaScript. Okay, so by the end of this course, I you guys would actually have a site working site that that has javascript in it that's powered with jobs with stuff in it. Okay, So that's it for this introduction video. Thank you guys for watching. See you on the next video where you start JavaScript. 2. JS I 2 Variables: Hello, everyone. And welcome to another video in your JavaScript. One or serious in this video. I'm going to teach you guys about valuables before we use our text editor. I like you guys to use Google first and then over not any new tab. And then this white click and inspect element or inspect and then go to console This console will allow us to use on interrupted JavaScript interface. Basically, we can code and immediately get the response from Okay, the first thing you need to learn is valuables so viable. Think off them past containers, ask something that changes. That's basically what a viable is something that can change to throughout the process. So valuable is something that we can also use to in your code, say, to save something. So think of it like this. What if ah, you sir, is trying to register for an account. And then, of course, there are some stuff there he would type in, for example, his name, his age, his birthday checked arriving gender. So you don't actually know those things, but you need a way to sort of store them. Even if you don't know about you. Don't know the name of you. So you don't know that gender that you suit? There are only a few possibilities for the gender, but still it's a viable can redefine it for every user. So what you can do is you can use variables for those you can is viable stone data which you don't even know about. So, like the name you can store the user name in a viable and make their own. You can start that that value into our database so that it would be persistent. You can reuse it over and over again. Even your code has been killed or the script has been killed. You can still use that. Using that's basically variable is So how do you declare a probable or how do you create to create a viable We use something called So the just whatever is going back here again, just explain it by So what we did here is something called variable initialization. A variable in this initiation does two things. One, it's a viable and to it gives that valuable of value on initial value to know you can actually access this valuable by that name. Now you see that the value of valuable is like So what happened here? This part here is the the name off the variable. So basically, this is what you give the variable the name so that you can call it with all you can re use it later on. So think of it as a container. Uh, Barney. So you have this container and you put something inside of that, maybe put off. So what will you do? You will name that container coffee So that later on, when you use it, you know, when you need the coffee, you know where to get the coffee to on the coffee contains. So in order to get the coffee, you need to get the coffee. So here, in order to get the name you get, get that mean complaining. So that's it. You declare a variable like this. And this This one right here is the word in computer from running, there are words which are reserved. Okay, That means these are words that you can no longer use as a variable name. It is something that is specific or reserved only for that computer programming language. So that means you can't be a viable whose name slipped because it's already a keyword that would therefore you can accuse. It was a terrible me. So that's it. Um, let's declare another viable. That's great on a viable. It's first mean, and it's after with my first mate here. And you, Can you put your first name there, put your first name. That's what I recommend you do with your first name on this on this part. So now let's passes the first. Then it's weight and other viable. You don't and put your middle name there and let's try to access the middle. Viable? There we go. Let's try and create another valuable or serving and put your surname there. It's drying access variable. So now you see that the value of the viable so name is my surname. Let's try to access again the first name. So it gives you that April just first name. It's like second, the middle name gives my middle in and start to access again. The serving it gives my surname. So that's how you create a vice. Always remember he would let Okay, key word. First you think you have a key word? Would you slip and then you give it that name off the valuable, and then you give it some value right there. That's the sort off since taps for creating a variable. Okay, now a sim packs a disused than the name symptoms of the word Sim packs a sink that's is in linguistic. It's defined as the set of rules that the burns the structure off a sentence. This is basically what makes a sentence makes sense. This is what makes a sentence. The scene fax. You can't have a language without a suit. That's so when you declare a viable or let's remember, that this is the same backs. This is how you think there is, how you construct a sentence, that it's a viable for you. So and then let's go for some routes. The name of the valuable name off the Bible. Basically, you can name your viable what ever you like. You can name it anything, anything that every like anything that gets inside your head. You can name that variable. Okay, whatever you like. But there a few patients, for example, you can do it. A variable whose has that That's name is dollars. And so it's back dollar sign. Oh, it's just freshen up and do that hit about this. Basically, thing is something that's more related to JavaScript in a deeper level. So Google issues dollar sign, but basically using Get ready for that. Let's think of a state that doesn't use JavaScript. I mean the best. Maybe this guy doesn't Actually, Here's what we do to solve this being Open up your your text editor, which I recommended Apple and then the on your desktop. I asked you to create a folder. Open that folder up in the folder on each table file bullet index dot html and then, yes, open up this folder Drug and Rob. It's right there. There we go. Problems. So let's operate a dollar sign. Variable. So now we have a variable that is $4. It has this value, but you can also be a viable that has the name of underscored to know you have a viable that's called that on their scores. But you cannot. We ate a viable that has a number of its first doctor. That will be that will cost an error. This is an air of his programming. We will talk more about programming error in later videos as you get along in government expert. So now you can be this bear in mind that the first the first letter like this one, this one should be either a dollar sign or on underscore or on alphabet. And then later on, after that first letter, you can now type in a number so you can wait a viable one by one and a very would underscore one in a viable on the score to you get also played a viable cold underscore underscore. So that's fine as long as you follow that they the detentions that that, uh, variables must have the first letter to be a dollar sign for an underscore or an alphabet. Then after that, you can follow it with a number. Okay, and you can also follow it without. It's like you complete and utter and underscore. So those are valid. Viable mix was. It follows the convention. Uh, that's it for the Bibles, and you can also have a valuable that doesn't have an initial value. Say we have. It's just a freshness that sets in I mean or valuable And yes, nets sandy color enter so Now you have a viable. That's cool. Name of variable. It doesn't have a value. This is called viable Variable Declaration. So that's what you call it? Viable declaration. And the last one waas viable initialization when we had a valuable that wash initialized, uh, me valuable by viable. Hey, I don't How do you work with one? Yeah. So now we have this name viable. A name off variables. So now we have a 40 era I can explain later on, but this is called viable declaration. And this is called variable initialization operation. And come on, initialization is by hate. So this spoke viable declaration and viable initialization to those are just terminal. You don't necessarily have to remember them or memorize them, but they are very useful when you're communicating to on other stuff for developer. And then what about this, Erin? So basically, this error is telling us that we always we are trying to create a viable but this variable with with the name with this name or where they exist. So basically, it's telling you Hey, you can create that viable because there's already are variable. The same name. You can have two bibles of the same name is That's basically the limitation. You can't have two variables of the same name. Always remember that. And the next thing is that how do you change the value of a viable? So if you have that variable mean by ago value Yes, I follow me. And now you have a viable with this value. So how do you change the value? Change the value, do the same thing except you removed the left, changed viable value. So now if you try to access the viable, it will have the updated variable body. So you just do the same thing except you removed the let keyword You just remove the lead cable so that the difference between this that this once were a thing viable and this one is just changing the variables value. This is called the assignment operator you are trying to assign value to about people are variable. We will get to know more about assignment operators later on. That's how you change. So they know that you declare a variable viable, are you? You think you can also initialize variable. You can also change the name or change the value of the variable. So that this these things you need to remember these things. Okay, you can declare a viable. You can initialize a horrible You can change the value of the horrible. But one thing you can do, he's changed their name. They're viable. I can't changed the name. You get changed then in the Bible that miss this viable name is just that you can't change it later on. Have already regretted you can change it. You can also declare valuables on this evening, so keep these things in mind. You can't have two variables. Read the same name and you cannot change the name off the variable. Also, uh, you also can't have a viable name. You can't have a portable main that has involved after as the first character of the name. So the value characters will be the underscore the dollar sign and any alphabet make a busy of any of any casing upper case lower taste. So these are all valid and the involved once would be numbers Syria Tonight you can have a viable name, but start speed Syria tonight you can also have viable mean that ask Follow the following symbols so you can use this US part of the Bible. Me also, you can use equal sense but a viable names. And we've lost sight and, uh, minus saying so That's it. You have to just remember the following things. Okay, this is how you once again, let's wake up. You can. This is how you declare a viable This is how you Winston shape a viable or initialized horrible. And this is how you change the value of variable and you cannot. You can change the name of the viable. You can't have two variables with the same name. And you can have a viable whose name starts with an invalid car just like this. Basically, you can only have a viable that has the following characters as the starting. The system was the first factor of the game that okay, I hope I made it clear about vulnerable on this video and later, only more about stuff that are similar to probable. Thank you guys for about and see you on the next 3. JS I 3 Constants: Hello, everybody. Welcome to another video in Jace. One course, this video. I am going to teach you guys about something called Constant. Okay, so on the previous video where we left off, we talked about the valuables and valuables have value, which can change over time, depending on inputs and statuses. States, depending on a lot of things, you can change the value of a viable. So basically, the value of a viable is a little bit, um, not exactly, very unpredictable. It can be predicted if you know the state of the cold, but other than that, it's quite unpredictable. But there's one thing that is surely 100 present predictable. And it's something called Constance so that Constance is the complete opposite of in a way that it cannot be changed. The variable can be changed. The body of the variable can be changed, but the value of the constant cannot be changed. Once you were aided a constant. It remains so throughout execution of the code. So let's try in the clear. Hans, me equals this Once point. Now you just have a constant. This is how you declare a constant. It's very similar to how you declare a variable how you ate Variable. This is scrawled a message. Initially station basically you created a constant that has this value. The question is, can you have a constant that has no value in it? You can't. This is because constant must have value. You can have a constant doesn't have a value because it wouldn't make incense right. You have what would be the use case off that constant that like constant That has no value . That that would be That would be quite you'd have thought You have a constant that has a viable me on the So if we on their press, enter and you can now access this constant name off constant and it has this value in it. If you try and change the value of this constant as you would be, survival exchanged value you would receive on error, Mrs. Because it's a constant. You cannot change the value of a constant one month. You declare a constant. It remains so throughout the life cycle of your application. That's the difference between once that so remember, this is the key word used to operate a constant in javascript, and this is the name of that constant and this system value that you cannot change it. You have to remember that you can can change their body of the constant. A constant must always have a value. Other than that, the naming off the constant make the name off. That constant is the same lead at the You can't have a constant constant that has that has a value. The starting position are starting. Name that name off the constant. You can't say it clear, constant, like so that's been volleyed. You can also change a get also do that that's also valid. You can also. But you can, however, do that. That's valued because this is a valid name of a constant. You can also do this, which is also valid. You can also do that which is also valid. We just talked about this so basically the variable in the value they have a rather the constant they have no difference other than constant must always have a value in a constant . The value of a constant can never be changed throughout the life cycle of your application . Those those are one thing that you need to keep in mind okay. And the putting about constants that they have you by my just use viable if you're if you're about the same. But the good thing about this is that it makes sure about any of the building so that your value in case you're working in a thing that the name of the constant valuable of the God of the devalue, the constant well, not accidentally changed by your limit. Because it's constantly that that they would have received error, which they would see, and they would likely they just correct right away. That's the usefulness of a constant. It's very useful. It would use it a lot on your coats. So I hope you learned something from this tutorial video. Thank you guys for watching and see you on the next one. 4. JS I 4 Arrays: Hello, Everyone involved from another video. In just one course, this video, I'm going to teach you about Bieber structures. So I have here where we last left off, and it's going to have fresh the pitch so it starts with with fresh. It's that's fresh with empty data structures, so the structures is like very abdicated sounding than we know right, but it's really not. The structure describes a US data, a way of storing data such a way that allows you to manipulate the leader effectively. Uh, one money sample off the structure in JavaScript is something. Hold on that like that. So array is basically like a valuable. It's very similar to a viable are is basically a type of variable. You can think of it that way, except that what a rave does is it allows you to store multiple data inside of that single viable. So then you can have sort of a list off things in that variable. So when it's let's say, let's start with foot. So let's wait a viable fruits. That's not how you spoke. And then you can you declare on a raid like so. So now this is a viable foots and the value is great. So this is a very viable so you can dry and access it and see that it gives you this thing in it. You don't need to worry about the tithe. Way will get to learn more about these things deeper when we actually start great being a working program that has functionality like next functionality. So for now, you need to learn what race are. So a race is basically like always. It's a way that you can store a list of things in it. So in this case we have a list of foots. Regan store a list of foods inside of foods, so let's now try and do that way. Do that by using something old methods. Methods are basically rebuilt functions that allows you to manipulate rate. So inputs that Bush then say banana. But now, so now you have entered or you have, uh, added the value banana into the fruits into the Foot's did the foods list. So let's try access the Foot Smith's so you see that it has one of them in it. It's called banana knots trying. Add a few more. What's that? Let's say Apple and puts that Bush, that's who. Uh, Strawberry. And it's boots that Bush cardio, you guys, then it's about foods that actually it's about foots. Now I think that we have enough. So what I did there is clear, but it really does is it? Claims the council, by the way, so you don't need to see a whole lot of things. So let's try and access the fruits. It's no. You see that the fruits has four things in it. It has banana apples to agree in a Cardiff. Now, the question is, how do you actually use this? Like if you want to get up from this area? Uh, take a look at this number here. This banana has a number on its left. It has zero, then Apple has one. Then Strawberry has to then avocado as the number of three. Now this number corresponds to their something called index. So that's the number of decided. That is the index, this index. It is what you will lose if you want to get a particular item on the list. It's no fruits saying it's good. Uh, nine. It has the index of cereals we put in in square brackets and then it's put the index zero. They're not get banana do. That's it. That's how you get. I went inside the list. You can also get a brother, but I'm going to tweet. So you get that index off the item. Which history and you get the value of that, which is the card that's basically away already allows with the store list. It's a list of things in it and the good thing about a race that it can get way so complicated. But this complex complexity it's very useful, and it also comes with a price that it becomes a little bit hard to handle for some your grandma. So let's dry and actually do something called What We Have You. Something will be singular. Hurry. That's most what I like to call it single by mentioned one day imaginary. We can have something called Duke. They mentioned. All right, what do they mention? Her rate is basically putting on a raid inside off on a rate that's like make a science. So it's drying aid. A new, valuable old, uh, a bag, a basket with a basket so they could get us a basket like visualized Pastore basket inside your head. So what can you put inside that basket? No, you can put a lot of things. It's a basket. Good fruits in a basket. Been vegetables in the basket. You can, uh, a lot of things in the basket, So let's try and put fruits in a basket. So let's go eight. Another viable foots. And also I refresh the page so that it will be receptive. You know, we have a basket. You have foot, fruits and basket are both a race. OK, think of our basket as a basket that has a device that is divided into sections. So it's like this where basket and has this. It's divided in it. It has this compartments in it. It's divided into multiple sections, and one of the sections there is we will allocate that section for the fruits, so we will put foot inside that section only so that the food on the basket doesn't get missed or mixed up. So now it's dry and put some stuff on the fruits. What's that push? It's saying, Uh, manner. I also like you can put whatever foods really goods that push Let's add in apple like apples, and it's ab a. I like grapes. Now we have four foots. Let's try and see what we have. We have four foot in it. We have banana strawberry, so now we have four puts. But we want to do is we want to put the foods inside of the basket basket. That Bush, partly our basket is empty, doesn't have anything to visualize. An empty basket that has that has compartment. It is divided into six compartments. It's divided in. Actually, it's just it's more basket that has do compartments in it, so it's divided into two. It's square basket that has a wooden devices at the middle of it, so this device or divides the basket. So let's now put in our fruits inside of the bus to the basket that bush and you give it the fruits viable. You give the foods viable inside of the basket. So now if you try and access the basket, you see that it's array that has arrayed in it. So basically, in that zero is now on a great Remember later on, when we tried to access this, others number decided and the number beside it is the index that tells you how to access a particular item on the list. Now here you see that our list contains another list ast, the index of zero in it, and that this has the fruits value in it. So now we have a foot in the basket to visualize a basket that hasn't fruit on it. The fruit is located on the left, most site of the left most, but now let's add vegetables. Basket. No one actually has very healthy. Let's get unhealthy. It's AB zone. Uh, meet for this. Add some week war basket. That's no great, a viable cold. It's gonna be an arrays that's great away. Then it's pushed into the league. Ever was like this a soldier like soldiers? Not it's in another week for their and with the Mai Mai Liquors wine. I love that line. Mama Clara is also why I really love that. You know, we have a war a week for a list of, and we have a basket less partial field. What we want to denounce the league horse into the basket so we do the same thing you did with fruits. Basket that Bush and you put in the report it was the leak or viable contains the league with the list of vehicles. It's not try and access. The basket should have two things in it. So now you have a basket. That's food. The left side of the basket has foots in it. The right most said the basket, the course in it. So how do you access the people with the same way as you would have access one of these guys on the poles? So let's say basket that and on brackets really have been the index zero, which corresponds to the list of yours. You know, we have the list of liquids, but how do you access a particular league war or a particular item inside of this leak or list? Basket the basket one. Because that's the So basically we are going to the basket and then we're going to the this off course, and then we are going to grab articular record. Let's rob me just also want Now you give you the I told me so. This is how you access movie. Do they mention race? So you go for a studio first. You indicate the first index off the list that you want access and then you indicate the index of the Eid. They want access on that list. So this is how you get value inside? They won't say that mentioned rate if you remember they on or a while ago with when we try to access one of them. We just did. I just did this because this is already the list. This is how you would access a one dimensional array. This is how you would access a one dimensional. Okay, so that's it for a race. Guys, I hope you do something really, along with now, instead of having a basket that has two things in it. Part of it twice the basket as a little bit bigger. It now has four compartments in it, so it has four things in it. So it's a square basket that has portico of medical devices and also her son down the visor on center for me. Something like fish in the past four quadrants, and it has four things for slots you can put in it. I tried to put every like on the remaining do parts of the basket, so I hope you learn about a race on this video? If it doesn't make total sense, that's fine. This keep going on watching the video on the move onto the next video. It makes sense to know later when you actually use them, and then you have used them on a regular basis. OK, so that it for a race to you guys on that video. 5. JS I 5 Objects: Hello, everyone, and welcome to another video on JavaScript. One course in this video we're going to talk about a big structural for dictionary dictionary is like similar directory, except that it hasn't different use cases in the way you interrupt. Pretty is also different from with direct right. Also gathers with a dictionary is not necessarily dictionary. It's actually called objects. So do the Claire Honore. Remember the last time you said something like before before that? Now you have big work. If you do this now to declare a declare a a dictionary gathers people on object. Object. We have to post me have to do this great. That's used constant. So that's great. A constant. And there it's going basket. Do not do the last example. There you go. Now what you have here is already an object, a whole basket, and it's constant, so you can change it. This would I'll give you an air because we created a constant basket. We can change it, and now this is our object or dictionary. It's currently empty. It has nothing. So what we are going to do is we're actually going to way do sort of the last example within range where we had fruits and have recourse. So we are going to do that. No clear the council first, so it's not bloated and memory or have a basket. So here's our basket. It's going end of its creed in the ring. Old puts constant quits post, and this time what we are going to do is we're actually going to. Instead, she the array rather the foot starring with We've values in it. First day Apple. Now you have an array of fruits and pass these values in it if we try to access the food. Sorry, there we have four. I bends in theory or list. We have banana, apple, grape and orange. Read the following In Texas, we have 012 and three indexes. So what they are going to do is we are going to add these fruits inside our basket. So what we are. So how do we do that? Remember on the last video, in order to do that way you something Bush, which in this case is not going to be how they legal aid something inside of the basket. We'll call it puts, and we will assign this puts to the foot. Now it be you are basket our object basket. You see that we have something called foots inside of it, and the value of it is arranged that has banana, apple and orange. Uh, no. That, instead of having the difference, is that this guy has numbers decided. So there's a banana, then 012 Then you have orange in objects. We have actual words began. Use actual words to use afterward words to represent the values inside of it. So in order to access the fruits inside of the basket, we can do basket bad fruits. Now you were able to get their foots from the basket, so that's how you add on object or something, and that's how you add a value inside a basket. So, uh, the object or dictionary is basically 18 and value their key, then spare me the value so it's quite similar with an array, except that with an array, we don't call it peace recorded in this. So this is going to before objects, and for a raise, we call the index the value you have Index value have zero as the index then have bananas value. You have won the index than you have the value you have. Do as the index. Then you have great as the value and three as the index then be orange. Asked the value for the baskets. Object. You have foot as the key, then arranged as a value. So you have fruits and value. Do you have a key right here? Then who's the value right there? So that's the good thing about best about objects. It's actually very good for programmatically programmatic purposes. We often use objects, 1% configurations and stuff inside a the program. So remember that difference is that you have key and value for objects, and you have also a race. And in this for value. That's the only difference between in a way and an object or a dictionary and also object. And this Trenary are sort of interchangeable in terms off JavaScript. But we prefer the terminology objects instead of fiction. In other languages, they call dictionary instead of object. So it really depends on what you are talking about. But in this case, JavaScript, because it objects, let's see what else it's trying to add. Another, um, he value bear inside of our object. It's ab in the equals. So we have That's great for constant liquid in initialized. It reads values. But it's then we have also Laura, and we have also The last one is so good about investing with this. So you have me and you have so that we can try and access study quarries. You have two items inside of this. Inside of the way, we have the index again and value index. Now, let's try to add the leak were inside of a basket. It's not the really added fruits is like this, right? Really Not gonna do that you're gonna do is we're going to I'm gonna show you something else. Another way to start of ad key value pair inside of your object. That's by using scrape rockets. No. Then you just spare rockets. It is very useful for something called the computer. Okay, which we will go on, please, on a different video on the dive, deeper into Twitter for Rahman. But in this case, we're gonna use it so that you guys are aware that something like this actually exists, make their only will actually use it for our program. So let's Abby in the league for piping. And don't forget the the quotation marks. So it's square brackets, then quotation marks inside of the rotation mark, it's no, it's full for. Then we will do equal label signed when we release the more constant. Now, if you view the basket, you basically have two piece inside of it to kiss and do do values inside. Do we have the foot skips and have the values right here? And then we have the recourse case and we have the values right here. So what about our away? We have numbers, right? And we also use numbers as keys for the objects. Yes, you can. Let's say basket that in this case you would use a square bracket notation. It's dry and see Ciro. Then it's agony. I have a number last night. Then if you try and do the basket, you see that it actually has a G that has zero. It has g zero and values this guy because now you can also change the value off, uh, hockey inside off on object by leaving something like this basket zero and now even exchanged. Now, if we try and be the basket. See that we have changed the values successful instead of this, which was the previous one. We now have this as the latest one. That's how you change a value inside of a basket. You just do. Basket dens have spare brackets again. Do the key right here. Could be a number. Could be strength. Talk more about numbers and doing in a later video. And then you just assign it to a new body. Nothing like that. And then you can also do the same for before and puts which, in this case, you don't have these square bracket notation because they're both doing so. Did basket that puts equals Do something else and it's Enter that, and now it's trying to be the basket you see that puts the value of the foods has changed this guy. So have foods right here, and we have this value. But that's how you change a value inside off key, valuable inside off basket. Now the question is, can hear in name a a key inside off a basket. Well, technically, you can't you can't see. I want to change fruits into food instead off. Yes, I said a plural. So you want to say I want to do the foot's to become something like Basket, that this is not allowed. You cannot rename a key inside the object which has already been created. You can, however they leave them. You can do something like you can do the greater than the basket that food. So now if you try and do that, if the fruits inside the basket would be deleted. If you try and go to the basket, you see that the the foot's inside of it has been deleted. It's no longer there because we just didn't get it. Actually, array the same is group. You can also see change on index inside and also they The index inside of Valerie is automatic. You don't separate them. You don't know. Set them like, say, I want this particular value to be 10. No, it has to go see Frank Shen, like Syria. 12341 It has to be sick. Friendship and like object and object is more flexible when it comes to the peace. Now we have the foot's not. We're going to this. We are going to change the index to into something else. We have a great period extension to Pee wee. Is it boots we have to do? It's que two. Now what? What you will do here? Issue. You just change the value of in the stoop from previously quick and now do you? So that's how you change a value inside fruits. But unlike in a race, you cannot use something like foods that something, because it's always going to be a number. It has to be only another That's a standard. It's something that programmers should follow. That the index of Honore should always be a number instead of a string or something, because that's the whole purpose of honoring to have a list, which has in Texas. But it's predictable. Unlike the on like on objects, the keys inside of an object is not predictable. So how do you actually get to know what keys are inside of objects? So you can't possibly know that there are, especially on objects. Quite. They know me if you generate the object logically, the keys could be quite. In that case, you can actually try and do something like object that keys. So what this really do this will give you the least off the case. Informal about rape, a basket to know you have an array which corresponds to the keys off this object, which is small basket. You see, we have cereal here. Also here we have equal, and you also have a record right here. So that's how you change, rather how you get the keys of unpredictable off and what else? You can also nest, by the way, on object, so you can get away inside of it. You can have strange Saturday at a number inside of you. You can also add another object inside of it so you can have on object inside. You can also have an object inside of us. Let's try that out its first freshness. So it's fresh, and that's created something called It's Used. Like this time. Yes, your Foot's No, it's safe. What's that push? But we will do is you try and push in on object inside off the foot, and it see um, foods that say I know I don't know a lot of fruits, so it's yes, divide on a rake off foots that I know you can also add, but they were foods like it. I'm gonna add the favorite ones, which I've been back China and Apple Orange. That said, it's not trying to be the foot's. We have an object inside of it, so we have a way that has an object inside of it as the first index. So we have index zero in that zero is an object, which has, I know us a key inside of it first. And this key has the value off on rape, which are the least so we can try and do puts Ciro, which will get the first item inside of their. And their ago it returned the object. It wouldn't the fruits that I know object. Then you can also try and do something like foods Siro that I know. And then it will actually give you the I know this this list. So you see, we were actually able to get this off the foods that I know, which is inside of the foot, I read. So you can also have on object inside of object. Let's try that out. Suppose it's fresh. This it's clear and say on sports the bat and then puts that because the objects not crying foods Way have puts. The food's object has a key called I Know in it and it's on object, but currently its empty. So let's try and populate the object. Um, puts that I know and then that's actually tried. Make the key the name of the food and then the value of the key. The rating of how much I like it have been for the massing love. Now we have fruits and inside forces an object which has the people I know in it and I know has the value, which is also an object. And this object has a key called banana that has the value of 10. So you get after we go foods that I know that that banana and you would get involve you and you get this. That's how you tried. That's how you play around with objects. This is objects are very, very useful in your programming. In fact, most of the time you and find that need to use that, especially arrays and objects, they go along together. So that's it for this video, guys. Thank you for watching. If this doesn't make sense, that's okay. Escape on. Keep on watching and then keep on following what I typed on the screen that when your brain was able to observe it actually learning okay, you don't have to be frustrated because you're getting confused or it's not. Doesn't make sense. That's how everyone starts. That's how you also start. Probably in a week or so you do. These things would start to make sense to you. So thank you guys for watching, and I hope to see you on the next video. 6. JS I 6 String, Number, Boolean: Hello, everyone. And welcome to another video JavaScript course one. In this video, we are going to talk about the types in the last video You In the last videos, you were probably hear me say strings and numbers and stuff. So those things are cold. Data string is a data pipe numbers also being programming. There are different types of later, and we sort of glossy fight things classified data into different things. So that weekend eight standard operations between them and how those operations who work the first type B The fact that you are probably already familiar with because we've been using a lot, it's called strength Now. A string is a big fight that, um, has the following characteristics. It is wrapped inside off single or double. So, basically, can you see my foot? Let's declare our variables. Mice are equal stools. This is a stream. Uh, take note of the single comm patients there. No, my eyes are is a stream. It has value, which is a string. You can actually try and get to know what the leader type of a valuable by doing something like dynasty are constructed. Now it's telling you that the Maya city are variable. Has the value off a string that the type of the value stored inside of my city are variable is asked me. You can also change that to say a number which is 24. I'm gonna sit under it before now. If you try and do my str that instructor, it will tell you that the data types now number No, this is a number. Take note that a number is not wrapped inside of a single. It's like this despite in the actual number that you need to use And then you can also add their strings by moving the book. Looks like that. Say this is a drink. So using double coats and single coats uh, they're basically interchangeable things. In javascript you can a single coat when you want to get this job. Brother again, use double quotes. So it's basically a standards of holding in a JavaScript in you most likely follow us down there holding like a restart Single brought a double coats. This kind of thinks Just take note that and remember that you can use you can use cyclical and you can also use double quotes. I a at the grill to declare a viable that has a value office. You can also being something like, Hey, what is my stream is actually occultation. So that's trying theories out right now. This value for my str What if we say we want it to be a contention that was said by someone ? Well, you can do something like, um, Brick comes made responsible, which was said by Spidey's uncle. No. What about that note you wanna wrap this inside of October? Court's gonna have the group of patients right there. So you end up with something like something like this, something like that. It's crap and said a quotation marks. And then there's this thing that's outside the rotation. What happens when you try and do this? It's gonna give us an error because we tried to use the noble boats inside off a string that is, that must create it using a double. So if you want a double inside off string, if you're using a double, you can use something called escape. You can use backslash and then backslash. So now you have double coat in backs, national double both, then the quotation, then another backs last double coat and that's it. And then another double. The end is doing. If you try and do that, you now have string that basically has this. It has a good patient inside of it, and I'm gonna show you a little. We can alert that we can alert my street and what's gonna happen is that we are going to shoot to see a pop up. It says with great power comes great responsibility and take note of the patients right there. So that's one way of doing it. That's one way off using double coat inside of a string. That way, using double goods, you can also, however, use single instead of double book like that. And I don't need this skip beans. You still end up with the same thing, same body. You can also alerted and see that it will show you the double quotations have double quotations with the video coats and you can also, um, being single goal patients. The same is true for that. If you want to have a single vote when you're already using a single quote for a string like that, this is not gonna work because this is invalid. It's not how you do it. You can use this. Keep once again by having a backslash before, before that and make sure it's close to having a backslash last one. So this is fair. This is also and a pair and this one. So you have basically two pairs off single cooks. If you enter that, you now have no a string. We had single quotes inside of it, but you single court to create that strength to see that single quote right there. You can also use double quotes inside instead of single. You know, you don't need this Baxter mattress. You can remove the backslash and you can you end up basically the same thing with a single gold inside of it. That's all about streets. We will talk more about strings on, made their video phenomena, freshness, actually, So it's come here and then it's talk about numbers. We've been, um, sort of talking about numbers. See if they're one like there's one in 1.21 point 3234 and so forth. So you see that we have a number that is a number, and you also have something called a decimal in for running. Those two are separate us. Well, the full say this way they value my bar. One. So this is viable is he's a number, so we can see that it's a number of by typing the constructive variable that constructor. See that it gives you the number. It's number, but it's also something hold introgen indigent. So on integer is a number that doesn't have a decimal above you, so it's basically a whole number that's an intricate, and there's also something viable. Waas, 1.1 so now are viable is still a number. Is it still a number? But now it has a decimal places. It is. It's still an integer No, it's no longer an indigent. It's something cold. So that's, uh, float is basically the name for a decimal number in JavaScript. You call them when they have a decimal value, and this is very useful. The decimal and WHO number thing. It's quite peaceful in terms of programming. That's one. You can also verify if a number is actually an integer or is it is it a foot or rather, a decimal body? So I know we have a viable and I think it's 1.1 because began Try is is in figure. Actually, we can just verify the value of off the off the of the decimal by doing something like bars . Part of ours it is. It's a function, basically a built in function, that what it does is it picks a number or something and converts it into an interview or a full whole number. You know you have one instead of one point 1.1, so now you can actually convert. You were able to convert a decimal into on in pidgin. The same is to a swell for for interview. You can also convert them into the fruits if you have 1.1 to 1.3. So what? What this does is it puts it into whatever it is converted into code you can actually put in doing inside of like that. So it's the clear variable. Actually, it's do this. You know, we have a viable which is equal to 1.3. But this was going to be right here. It's not necessarily a number. If we try and big block on its big A type like you see a number or not, you can see that it's actually cold drink. So you cannot use this for processes that require smarty markets that they having deploying drafting numbers can abuse that beginning. Subtract three. Read on in pigeon and expect to get a mathematical result. That's not how it works in programming. We need to ensure that they have the same artist they have seen. They are the same thing, the same nature. So what parts dust is it converts it into a number. So now what we can do is we can go. He busted farce float to know you have a variable, that constructor. You will now have a number instead off strength. So it was converted from a string number. So that's all about number. We have in danger, and they are both foot. And besides that, we have one more thing, which is also very common. We have something. Hold the billions. A bullion is just two things. Uh, it's either like that or it's also either or it's also it's It's either, of course, So that's a Buddha. True or false, you can have. They are viable, viable it waas, too. So now we have a viable. That was a sign that has the value off through inside of it. So what is it? What is the type of this value? Now we can try and see the constructor, and you see that there are a 1,000,000,000. So basically this viable is off the buy bullion. That's what billions all about. It's about two or force about one and Syria Napoleon is convertible into number. A true will convert into one and false convert into zero. So basically, that's how women's work one and you one. But thanks to two and zero portents do two. False. So that's the defects. So that's it for this video. Guys, keep in mind these doing data points because you would use them quite often in programming . The number, the string and the brilliance. Okay, so thank you guys for watching, and I'll see you on the next video. 7. JS I 7 if else if: you know everyone and welcome to another video in your guest. One. First, this video we are going to talk about control of those fractures on both flow structures are very useful when it comes to allowing a beauty of a program to perform specific action based on a specific input, or especially if it's specific. Thinks basically allows the computer program to make decisions and seemingly appear intelligent to do the abusive to the use of the use of off the program for anything else issue. I'm going do fresh mine browser. And of course it's gonna clear the council. I hope you guys have your browsers open now on. So So what? People first take a look at it. Something be conditional flow structures. The 1st 1 is the if the if, um, the problem so that if and therefore allows you to make a decision, only a particular condition was met. So basically this thing will only run Whatever code is inside this clearly place curly brace opening curly brace and a closing curly brace. Whatever code is inside of this will only be executed if this condition inside off the oftentimes parenthesis this condition right here is true if it was met. Okay, so let's try and practice. If let's declare a variable that story, it just each and it's equal the age do. Okay, so what we will do is we will actually try to alert something on the screen. If the age is seven are 18. Basically, we will try to determine if the user given this age I don't mean is already allowed to drive forwards or a car. So in the Philippines you can actually drive car runs. You are already 17 0 you can get a non professional license and start driving your own car . Let's try to do. If so, the first thing that we'll go inside of this open and closing parentheses is the condition B. Every condition one. In this case, we want to determine if the age is saying greater than if it's weather than a 17 17 year old 17 or greater than or equal to 17. And then let's do alert. Yes, you can get any license, a driver's license. So what happened here is that there's basically nothing happened right now. The the this thing was not executed because this condition right here was not met. Remember that the ages only 13 and his 13 greater than 17? No, it's not greater than everything is. It also equals 2 17 No, it's not equal to 17. So this particular code right here will not execute. They will not happen. They will be ignored. And the program will continue on to the next coats to the next. Following codes after this gold right here. So, um, it's dry and extend that and actually do on alert right here and say finished and it's enter to see it said it. Alerted. Finished, but it did not alert. Uh, yes, you can get a driver's license because the condition right here was not the condition. My period was not met, and therefore the codes inside of this open and close curly braces plus not executed. The program continued on after this whole block right here, which is the alert right here that says finished. So what we will do is we will try, and he said, the age equals 2 17 So now age is 17. And yes, when you try and do this again, you can in the drive. So let's try that enter and says Yes, you can get a driver's license. And it was also Lord finish. There we go. We got finished. So the condition right here was met its first. I saw this block right here and said, If oh, this is a condition on, I'm supposed to check if the condition right here is true, that's what the sort off the program is starting to determine. To do so, it said this age greater than 17. No, it's not greater than 70 ended, but his age equals 17. Yes, H is equal to 17 and therefore I'm going to do this. And that's why we saw on Alert that said, Yes, you can get a driver's license. You can know this greater than equal sign right here basically says is age rather than or equal to this value right here. So it's this value right here, greater than or equal to this value right here. That's what the condition is trying to check for. And then I introduced you to something called the else part of the If you think off a situation where you wanna do something about it, so at first we're not going to do something about it. But if the user asked, the status of age is less than 17. Basically, we're not going to do anything about it. But what if you need to do something about it? And that's when the else comes in first, let's set the actually let's like in the else. And then it's alert. Say no, you can't. You can't yet a driver's license. And don't forget the backslash, then single port because we're using single court right here. Remember the last video we talked about the strings. So let's enter and says Yes, you can get a driver's license and said Finished. What happened there? First tried to check The condition is age greater than or equal to 17 age 17. So yes, it is. Aged is equal to or greater. That's evident this condition right here Waas met. It was true. So this block code right here was executed. So whatever's inside this first opening and closing practices and then we have this else right here the else part got No. Basically, the computer ignored the else part because this condition waas too. If the condition was force. If it was not met, thesis part right here will be ignored, and then he sparked by here. The else part will be executed instead. Let's try and see that connection. Each set age equals 30. Actually, it said HPV 16 and then it's try this one again. What will happen here now is that it is trying. Jack is the age rather than or equals 2 17 which, of course, is false because age is 16. So this block off right here will then be ignored. His highlight. That code will be ignored by the computer, and then this code right here will be executed instead. So let's try and do that Press enter. So you said, uh, it said no, you can't get a driver's license and say Finished So it tried and check this, but it was not true. It was false. So this block was ignored and this block instead was executed. So that's the if else condition control. So structure. Now there's also a time when I just in fresh beach. By the way, there's also a bang grin. You're gonna need to make more than one checks because right now, with the if statement, we are only checking for one condition, right? But what if We also want to check for another condition like, See, maybe this condition is This condition is forced, but then we will need to have another condition, Uh, where people buy and do we sort of try and check for something else if something comes, it's true instead off this guy here, and that's when something will be else if comes into play. Now this else if is the combination of if and also else basically what it does this. It will try to check for something like this guy right here like this, right? That's right here and then check if the condition is true and then if the condition is true , it will dry and go Go on and execute the code on the open and close curly braces that that was spared in the else Keefe statement. So let's check in the age is then equal, equal. 16. Just type in equal for 16 and then say you can get drivers license next year on your birthday. So what's going to happen here? Remember that? Let me first cut that out, and that's trying. Check each. We don't have the age, just refresh the page. So let's create a viable called age and its sequel, that 16. So now the age is 16 here, age that has a value of 16. You have a variable age, nobody 16 but it's put in the landscape and condition. Yeah, and it's right through. I m gonna try and explain what will happen here. So first suit. Well, check for the father in condition. Is the age greater than or equal to 70? It will try and see if the age is it will do or greater than 17. And if it is, it will grow and execute this block off goods right here. If it's not, then it will ignore this lock off holds right here, and then it will go to the next condition, which is the else, if it will now check to see if the age is equals to 16 is the age because the 16 is the age is equal for 16. It will then try to execute this block off right here, and then It will ignore this part right here. But it's in the event that these two conditions were false. These conditions were not met. The else part real then be executed instead. So if you happen here is now the 16. This will be ignored, and this right here will be executed. And this right here will be nervous. Well, so you see, the you can get a driver's license next year on your birthday, and she finished. So now you see that you get you can get benefits license next year on your birthday. And it also say, finished the this laugh right here. Last guard. And this block off code right here was also ignored in this block off court. Right here. Rather Ross executed. Now that's try and set. The age equals to 7 to 21 actually. Yeah. Thank you. And then it's dry and do the same. If conditions again. Let's now see what will happen in this case, The age is 21. So the computer will get across this part right here, This condition and then it will try and check the age radar done or close to 17. Well, yes, it is greater than seven. So what happened is this block off roads right here will be executed. And then after that, the else if in the else part, this guy's right here will then be ignored. They will be discarded and then computing will go on the next line, which is the alert pinch. So then we will see. Yes, you can get a sense alert and then we'll see finished. Let's see that it says Yes, you can get a driver's license and then said Finish And then let's try and check if the age is under 17 which is gonna be 15 and also under 16. Just 15. So the ages 15 Let's see what will happen right here on these conditions that we just work . First, it's gonna try and check. Is the age greater than or equal to 70? Which it's not just this part right here will be ignored and discarded. Then it will dry in check if the age equals 2 16 which, of course, it's not a bus to 16. So this part right here will be excluded. It will be discarded and then therefore this part right here will be executed instead because one of the following one of the none of the holes above it out of these guys were through none of these guys where correct. So this thing right here this else part right here's a lot of good right there will be executed instead of the's guys. Now let's see. No, you can get a driver's five cents part and then you see finished. So it said no, you can get a driver's license, click OK, and then you say Finished, which is the last part. So that's how the if L. Steve works. The thing about this is that it can get us long us you needed to and you can also remove certain parts. Like for example, you can actually remove the else part first. That's trying, said each do saying, If Kenya way have age 15 and then it's removed the else part What will happen here is that this condition here will be more. I mean this big more because the condition is false. The black foods right here, big nervous. Well, because the condition is also false and therefore we will only see on alert which said which will say finished. And there we go. There's our finish. We can also try. They moved the else if part which we only had last time, we have only if and then else. But we can also have more else ifs say, Have you? So we have this as if right here, right, we have the else. If it's 16 and in a deuce, you add do longer. Just else. If ages really do, 15 Didn't say hurt. You can get a driver's license. I'll stay on after. Do more work. Let's add one more. If the age is actually, then I would say they do. So let's try and see what will happen here, since you can get a driver's license after two more birth based. So what happened there is that it went through this guy. So I cleared to this collection of chain is strange off conditions right here and checked for each condition each of the conditions here. And then it executed the 1st 1 that it's appeared to be true. It executed the payroll the only place early braces that appeared to be through on the condition, which is this part right here, because the ages 15 right, so this condition will be poor and this code why to be executed. So that's how if, if would be showing works, uh, there's a lot of things you can use with it and It's very, very, very useful. You would use it a lot in your computer programming. That's the idea. Off and Steve Conditions basically allows our computers computer program to perform a particular operation only when a particular condition was Smith or a particular street. That's very useful for a lot of things. Your app on your phones and even Google Chrome uses it. So thank you guys for watching. I hope to see you guys on the next video really learn more about control flow structures. 8. JS I 8 switch case: Hello, everyone. And welcome to another video on JavaScript. One first In this video, we are going to talk about something called a switch case statement. We are still on the control flow structure topic, but we are going to talk about specific switch case statement. It is basically a continuation off making cross low structure. So on the previous video, we talk about the something if else statement where the if statement allows you to perform . But people are operations under specific conditions. So when a particular condition, uh, this group is to then you perform these particular actions the same that such cases statement basically is built on the same cancer, except that there are edge cases where the statement is a lot more useful than switch a statement. There also edge cases where a suit a switch statement is a lot more useful than the if statement. Rather, the bees. If a statement, it's a lot more useful than the the which case statements. So basically, you can use between this, you can choose between these two things, but basically whatever makes sense or whichever you think is the best one to use. So let's, uh, used the same examples the previous one. We start with something called The Age where we identify the U serves. Age is over the users age. He can get a driver's license. So let's start with the age of 16 and I want you got just so that the age is actually age off. That that that's a legal where you can legally drive a car over the scar. You can you replace it on your country. On my country, it's 17 year old. You've been only drive a car in your country. Maybe it's different. So I want you to be on that so that we sort of apply your own idea. Your own concepts inside of you say that the exercise. So let's do something for the switch. This is how you do a switch based statement. First, you that industry one switch and then inside of this off this particular, um, particular US open and closed parentheses. You type in the variable that you want a switch. You want a target. So basically, you're gonna use this value. Do, uh, this is the value that you will try to identify, and then the cases would be the guys that would allow you to to make the conditions. So which kings see if that the case in case of 16 what we'll do is we'll alert say you can get a the drivers license on your Knicks birthday. And then there is something called the break. You need to pack in the break. This is to indicate that, Okay, this case is now over and we wanna exit. We would oppose this guy and then continue on under the next line. Whatever comes next, say finished. And then it's Bean The case of 17. You can get a driver's license now because you know you're only 17 and then we're gonna add something called the default default APS us the else before that, the break here. So the default asked as the else off the else statement. Remember, we have, if been conditioned that this out This is fresh, you know? There we go. Remember, we have If else so. Basically, the else is equivalent to be different right here. This is what's going to happen before none of these things we're through. One of these things happen. Then this guy right here will be executed. Let's say alerts I don't no your age. Let's say, Uh, yeah, I don't know your age. Let's do that. And it's moved this part. Let's try that out. Oh, I forgot the beach forgot to declare their age. It's great the age that age 16. Donna, let's try, Do identify what will happen in this particular we have a viable with sense, created a viable called age, and it has the value of 16 in it, which is a number. So what we're gonna do is we're gonna try to identify this value based on the value off the age. We are going to perform something specific to the age itself, to the value of it. If the value of the age of 16 this part right here will be executed and the rest right there will be ignored. The same thing is true for 17. And if none of these guys cases were two cases were executed, the default one would be executed instead. So it's basically if else statement nice tried this out and you see that you see that it says you can get a driver's license on your next birthday on that If we got in OK, it was alert. Finished. It's finished, so that's that's what happened. The 16 happened. You know, that's why the 17 age equals 70 and it's just there. No, it says you can get over stressed since now and then the finish and then astride the started rigor, the the default but age. Oops, agent. Now what will happen here's that these guys will be ignored. They will not be executed. And this part by here will be executed instead. Not since I don't know your age, which is the default part and then says Finish, which is this last part. So now the difference between an if statement and switch case is that the condition is the value of which you are trying to assert. First you get one faction right here. That's very that's very useful. If you don't want an ASEAN function over and again over and over again, you can also do that with if state except you're gonna have to. I put that inside a viable, but the next thing that's many good about the switch case statement, but some developers tried to discourage the use case of this guy. There's something called the, um the brake on the full, too. For proof. Uh, how about a sample for these 16 17? Oh, I see. Let's try and say that's removed this guy. Let's move the break right there. And I think we have the ages said age forced to 60. No, I have the age of 16. But I will do. I will remove this break like right here and I will express Enter and then I want you to observe what will happen. So it says you can get a driver's license on your next birthday because the age is actually 16 to the spot right here. Were executed, respond by killer executed. And I've I click. OK? No, it says you can get a driver's license now, which is right here. Which was supposed to be Ward because this part right here waas executed this'll guy was supposed to be supposed to be. If you try to sleep, okay, we'll go to the finish, which is right here. The thing about each case statements just just keeps on going from the first time it hits a a tour. A two year old like Yeah, this is 16. Okay, that's that's good. I'm gonna do this guy. I'm gonna do this guy. I'm gonna execute this court's right here. And then what will happen is that if the break this guy, the break, it's not there, it will just continue on with this case is regardless if they are goodness of the condition , regardless of this part, well, we'll see there if this guy, if that the conditions to or not already that will try to just execute all the votes right there until it hits a break. So basically, this break is very, very necessary for a switch based statement. This is called the Photo. There are some cases where this this process or this trick is actually useful. And there are some cases when the strike is not useful and most often the not. This is rare. You think you you could use a switch space statement. You could also use an if else statement. But there are a lot of use cases for if else statement, especially when the condition gets to be a lot more complicated when it gets to be a lot more complex Right now. Examples on video You are very, very easy. So you see, we just have just asserting the age, which is just one condition they're in in real world scenarios, where we will get to later videos. Thes guys get way too complicated. They could ness they could have. You could have movie poor conditions and stuff. So basically the switch, the statements I rarely use. But some says it has performance bonuses, brother performance, performance benefits and stuff like that. That's I think those are very, very debatable. So yeah, so yeah, that's not switch cases statement. It's basically almost like if else statement the suitcases statement Always remember that it basically just allows you to perform about Bigler action based on the condition. Okay, based on state or condition of your coat or user input. Something like that. So it's basically what will allow you to make decisions. Okay, this is very useful. This is also how your green my court, we're always doing this each case and if else statement all the time like I'm hungry. I like to eat like I'm hungry and I want to eat them. I'm going to it, but also, if there's something great, So now you have three conditions like you find hungry and if I want three. I have something to rethink. I will it. So that's basically like a little bit complex condition. So only if else statements then do something like that at this. In a way, that's still, I'd say, encouraged by the community. So, yeah, that's the switch statement. I hope you guys learned it. Maybe will find a use case through this guy when, when they get to one example. That's absolutely, uh, more really work related when you get to create actual apse with JavaScript to thank you guys for watching see you on the next video. 9. JS I 9 While loop: Hello, everyone. And welcome to this video on your JavaScript course. One in this video we're going to talk about. Talk about it was trapped you that allows you to perform a particular procedure over and over again. Basically, think of it like this. Imagine that you have 10,000 data and then among those data you need to filter a particular data only, like a group of data. Say this data is the record off 10,000 people. And you need to do to feel they're out the people who are single and at the same time whose age is at least whose ages equals do, or below 24. So you need to figure those out. The only way you can do this is by going through each of those data and then actually checking the data itself to know if you need to include that data to the filter this or not . So control structure hold loops, allows you to do just that. So before that would stop about lugging. So I'm gonna teach you something from the console that look no there. So what this is is a concert work? Basically, it allows you beloved something on the console. So imagine that you have something that you need to see. You can use Consul rug for that. So console loves very useful, especially for the babbling for persists. So we're gonna use it like this, Okay, constant work, and you don't need to worry about it. Just need to type it as the way that type it, and we will go to it a lot on a later video in a lot deeper explanation, because right now this is really not part off is a bit more advanced than than your current status. So let's talk about the loops now. That's that's the main point in the video, but we will talk about first. It's called the Wild. So Ah, Wilder is a look that has only condition, and it and the condition is being checked. If the G If, if the condition is true, then the group will run again. Constable Bishop has been false. Then the group will no longer one. So let's talk about let's let's do something called counting. So let's say we want count from 1 to 10 or 0 to 10 or actually want 10. So the only way we can do that by doing consoles that plug one and then concerned that love too. What about love? Three. So that four and so on and so forth. You can do that all the way after 10 but that's not very productive and very efficient. So what we would do is you just loops to achieve that kind of effect. So let's get this out. And its first grade a variable called count and it's energized that one. And then what we do is we part in the wild. Meanwhile, the counts less than record 10. Then we do console that club counties now about this help. And then after that, we do count equals to count, plus one. And then it's considered that love below here or finish. Then press enter. You know, you see what it did. This is counted. So it first it went to one right here and then two, then three all the way up to 10 and until the looked has completed. So the finished right here indicates that the loop has completed its now out. So what happened here? Is this this part right here? Is the condition off? This condition allows you to control the look, but there's no no to know whether to continue or to stop the loop. And what this is checking is that is the value of this valuable found. Is it less than or equal to 10? If it is less than or equal to 10 then the codes right here on the curly braces inside the curly braces. These codes will be executed, which is very do the console log, and then it's going to this land right here. What this is doing is it's going to take the current value off count and then add one to it and then assign it to the count. Variable. Do not account. Viable. It's going to be is going to be the value of count unless one. So this is always going to one. That's why we get this. We are counting sort because of that's because of this line. Now I want talk to you about the condition and also this part right here. The condition and this part is very important for this. Look for this example. Look, because if you didn't have it, what will happen is that you will end up. It's something called the infinite loop. Now on Instanet, it's basically a loop that doesn't end. It goes indefinitely, it executes indefinitely. And this infinitely When you when you failed to control this insolent look, What will happen is that your program will sooner or later crash it will fail because off this infinitely, basically, your program will be stuck on that infinite loop forever. And the way you can do that by doing this number fresh the beach and I'm gonna prepare the task manager, I'm gonna have grown to be unresponsive because of this. So do this at your own risk. So what I'm gonna do is I'm going to remove the increments right here. I'm betting movie, and then the count will then be will always be one. Which means that this condition right here will always be true because the country's always going to be less than 10. It's never going to go above. Then it's going to be always less than men, and therefore this will always execute and finish right here. The finish right here will never, ever be executed. This code right here will always be executed. So that's tried it out. And we left now my chrome guests hung. So yeah, that's what happens when you do this. Basically, the Soviets, the console hunks. So, yeah, so that's the downside off trying to do this. So do this at your own risk. Your computer may also freeze, especially if your computer's not powerful enough to handle it. So I'm a communist loved right now, and I'm completely stuck in that look and the reason why we're not seeing any things that because it's lugging. So let's now try and stop it. Oh, but I think stuff that ever having against do offering made there this was on the wrong. Now that's end of crosses. And there you go. Now you're seeing the loved and it's being loved. It has been loved for 88,000 times, probably more still logging, though it's a fresh page now on consulates, The loving Yeah, it has hanged. Also House home. So yeah, that's the infinitely you need to as much as possible, either with role or avoid infinite loops. There are some instances when Infinite Loop is actually very, very, very useful. Yeah, it's their insistence that it's useful, and there are instances when it's not useful. You just need to be able to control the infinitely. That's that. That's the thing. You don't wanna be on that infinite loop site off forever. Never. You need to somehow find a way to stop the infinite loop. Um, if you want their program to continue on So that's the wild. That's just a big week up. And was that here with this? So the wilder what happened here? So I'm gonna explain again. We created a viable called Count the Assigned one as the initial value of the variable and then on the wild. When we hit this part of the code, we are going to first check the count. The conviction. First, the condition is going to be checked before we even tried to execute this code right here. So the condition always comes first before the execution of the code on the curly braces. So first checks the condition. Is the count less than or equal to 10? Well, count is equals one. So it's one less than or equal became Yes, one is less than or equal to think, and then it it executes this block off roads right here, Hopes again highlighting what's happening. But There you go. It executes this back off codes right here and then this guy right here is responsible for increasing the value of one, rather increasing the value the value off count s so that it will reach a point when this condition is no longer true and therefore the look will no longer with no longer run. Actually, that's going with fish. What I'm gonna do is I'm gonna try and show you the value off count after it has exactly the look because we can still access. Now the value off count is 11. And that made the condition force. So it's 11 less than or equal to 10. No, absolutely not. And so what happens is this off course right here will no longer be executed and look will end. And then it goes to the next line of code. That's what's happening right there. And then there are also instances when a look will not run initially, especially when the condition is false, but first So let's try in front of a bitch again. And it said that the value off calories 11. So what will happen is that it will check the condition 11 less than or equal to 10. No, it's not. So this block off roads will no longer be executed. They will be ignored. And then it goes all the way down here and we will see finished with account of 11. There we go. See, finished with count off. 11. So, in this case, the the blocks of code inside the loop was not even Does that have been executed? That's because the condition initially was already force. So it disregarded the roof. It went out of the loop and then discontinued on execute a solution of the program. So that's it. We need to remember that first checks the condition. That's the very first thing that it will do. The why Look will always first check the condition. And if the condition is true, it will execute this blocks off course right here. And if this and after executing this blocks off right here it goes again. Those the check again. The condition the condition still prove. If it is still do, it goes and executes this plan off colds right here. And then it goes back to the addition again. And if it is, if it is still true. Then things blocks of codes right here will be executed and so on and so forth until this blocks of this, this condition rather has become force. So it will. That's the cycle off the look that basically, that's what's happening here on the part of code right here. It's very small, but there's a lot going on there. So that's it for the control structure. Look called Wild Group. Thank you for watching guys and see you on the midst video. 10. JS I 10 Do While loop: who? Everyone. And welcome to this video on your JavaScript course, one where we are going to talk about a loop control structure called Do While So on the biggest video we talked about the wild look, also the concept of loops. We also talked about the Infinite Loop. Now we're going to talk about something called Do I Look? Do I Looks not very different from the wild. They have the same concept, except that the behavior is a little bit different. They do. Why Live has an extra at the concept in it. So let's do this by doing the reviews. Example. With Count, we're going to count from 1 to 10. Let's do people's one. Let's say Do console. Let's just love the value off count And then it's make sure that the value of count increases a Stein passersby. So we're going to do countless one. And then, after this closing curly brace right here, we're going to tap the while and the conditions while the town's less than or equal to 10. Then here, let's love finished with a value found, finished and count. So you see that behaved very the same recently with the wild. It is still counted from one all the way to 10 and then when the exited, when the value the look was finished, when the value of Count Waas 11 already so behave, it's basically the same rate and you can also have a new infinite look with do wild look, so it's basically the same with the wild. The difference now is that remember when we did the wild and the one of us is it checks first from the condition, but the while of dusty See first. The first thing that the look will do is always going to be the check the condition. And if the condition is false, it will not even run the the the loop even once. If the if the condition is initially but the first time, if it's already force, it will not want the look. But we do. I look what it does is first. It wants the it wants the look, the procedure inside the loop it once it first and after running the procedure off the look , only then it will check for the condition right here. That's why the while comes before Rather comes after the block off codes that you have for the loop in the wild. Look, you have the while before the black off codes that you have for the look. But do I live? You have the the of course before the condition so you can actually try. And you can actually see this by assessing fresh roughage. And then it's do count off. 11. So what this what will happen here is that this guy right here will still run, and then it will check the condition. And then it would realize that the condition is false, so it will exit the loop and go all the way here. So now you see that said count 11 And then it said Finished. Well, so basically it run the block off roads right here first before it even checks for the condition right here. So that's the difference between a wild in a while. Other than that, they're Suckley the same. They're basically the same. But there are instances when the while the do violence is actually useful than the wild look. So that's it for this video, guys. Thank you for watching and see you on the next video. 11. JS I 11 For loop: Hello, everyone. And welcome to this video where we are going to talk about the control structure called the for Loop. The furlough is basically the same with the wild, except that notice in the wild. It only has one part, which is the condition in a for loop. It has to be parts which we are going to learn. Well, let's start typing. This is how you create a for the first part of the following Is the viable the second part of the whole of this? The condition that they're part of the four look is the increments. So let's start moving things out first, is the viable? Remember that this Bible Declaration refuge is outside of the This is the look right here in this. These are valuable. This is what we are dealing with the variable. That's basically what helps us controlled. Look. But it's outside of look inside in the for loop. It's part of the of the book itself. It's part of the farm and then we have the condition, which is part of the while loop. We can do that on the condition right here and then we have this instrument. We could move that in the intimate part right here and then over. Need to do now is to move the lugs and relax. That is basically our our four. So what it does is still the same old. It's not forget the count should be equals to one mission. So this is what's gonna happen here. First week eight viable. We call it the count. We call it one count one, and then this is our condition. We check if the count is less than or equal to 10 before we even continue on with the look . And then this is the implementation part. This is where we try to income it. The value that we are dealing with the body of count in this case will be implemented will be increased by one. So basically, we are going to set the value come to the value of count to us one. So whatever is that value? We just had one to it, and we that's the new value of and they've been side off the block off the photo. Right here we have this council working the count and then outside with this concept, like finished with the Count I don't see what's going to happen. You now see what what it did. Is it counted from 1 to 10? Something as do I look, did what it has discounting. It starts with one and then goes all the way to 10 and stops right there. But notice the difference is this produced an error this line of code right here through an error pieces on error message. Basically, we are going to deal with error messages being more on later on videos. We are going to deal with them, talk about them on a much deeper level. But in this video known that this cut line of code right here it had to do an error. It has an error message in it. Basically, it produced on error. A modest the era said that the count is not defined. That's one more difference between the wild look and be and the four loop. So that's the pound. That valuable right here is very important. It's very important that you know what kind of variable you are declaring. In this case, we use the left keyword to create a viable. This is this has something to do with something called the scoops, the scoping, the viable. Just know that when you use a lead for the 44 look, you can a access the B, the variable outside off that look. That means this vital police variable right here is only accessible inside. Which is this part inside of this look. That's the only place where you can access it, where you can access the account valuable the loop itself. Outside of that look, you can access it, but there's a trick that you can use. Let's fresh stoppage and let's do that again. Except this time it's used the bar keyword and it's try it out. So you see that this time it behaved a bit differently. It's also one thing to take note when you are using for Loop uh, key word net, and he would bar behaves differently when it comes. Takes scoping, but we're going to talk about scopes a bit more on a later video. We are going to talk about them on a much deeper level. But now remember that the four loop, if you used let you can only access the variable inside of the book itself, except if you use var If you where you can now access the look out our other variable, which is count outside of the Okay. So I hope that makes sense to the difference between the wild look and the Do I look in the phone? Those are the three primary group structure control, slow structure in gathers with only have three by look, do I look in the phone? So that's it for this video. Guys, thank you for watching this. Take note of these three things because we're going to Houston quite a lot. Especially the Fulham's on future videos where we actually create usable APS. Absolutely that other people can actually use. So thank you guys for watching and I'll see you on the next video. 12. JS I 12 Function: Hey, love everyone. And welcome to this video on your JavaScript course one where we are going to talk about something called a function. Now think of it like this. What if you have this set off codes that that dust particular thing and then you need it for more than one place on your app that you needed on the landing page, then you needed on the registration page, then united on, say, the user profile a big beach. So what if you need it for more than one 11 beach or one place on your app? What are you gonna do with it? Are you going to copy and paste? No. Sent off kouds three times Or are you just gonna have a set? One being one code that holds this particular codes and then you can really use that gold. And so when you ever you need that functionality, you can guess we're using, like, wherever you like. Basically, that's a function a function when things inside it a set off codes. But you can reuse over and over again the set of goods supposed to do something. Say, what do you want? You want a part of a number. You want a part of it and don't interfere. You want a passage in your foot? You wanna you wanna power even a count the length off particular string you wanna count how many numbers there are on a particular doing? So that's that's that could be a function. You could convert that functionality in my function. And then you can really use this functionality over and over again without having to rewrite the same set off codes. And then what you can also do is this. You have to only maintain that that particular function. Whenever a bug comes in, you only need to fix it on monthly's. Now the bad things. This that the downside is that if you reuse dysfunctionality that your use it on, say, three or four or five different places on your app, and then you found out that there's a bug in it, like an error or something, theological error for a particular input. What happens is all those other places where you used it on five times you will experience that bag because you're basically reused. Same code that has above unit. So that's that's one of the downsides. But the good thing is that you only have to fix it once, once you have fixed it. The rest of those Oh, off those pages would also be fixed because they're using the same within the same function . So this I would show you how you've been using a function. Say you have the consular. So this, on its own, is a function. The love is already a function. Here you are calling this function and then you're reusing this functionality. The functionality without it serves over and over again. You can do it more than once. You can have it on multiple places. Right now, we only have the consul to play around with. But soon you'll figure out whether you you appreciate how important functions are and how very useful they are now. You also have a function something called the bars. That's a Paris food. This is a function reasonable function that basically price to revert a number, a string into a number. And we also have bars which almost does the same thing with the passport, except it's going to convert it into an integer, therefore disregarding the decimal place. So those least these three these parts in the passport and consular. This log here, all of these things are called built in functions. Now, this log here is a bit more complicated. Not exactly complicated. They does exactly the same thing, they're releasable, except that this one is a bit more deeper, but we're gonna get into it on the next videos. But for now for was on functions. So these two things right here that we have our cold functions. They are also hold built in functions. They are built into the program and that the programming language that means the programming language itself already offers dysfunctions, dysfunctions. You don't have to recreate. You don't have to put it apart in function for your own for a program, because that part in function already exists. And all you have to do is to re use this functionality disfunction that is provided already by the programming language. So there are built in functions. This remember that there are built in functions that the programming language already provides for you, one of which is the person in the past, we did not have to create them. You only have to use them because they are already available for you now. What we are going to talk about here is that is something called the You served the find function there. We are going to experience or encounter and use a lot off other built in functions, especially when we actually start to grate on app. That's reuse of that. That's usable, Um, but now we're going to focus on the something called the the Use of Defined functions. It was the built in functions. There's just really nothing very special about them. They're just functions that are already provided, but the programming language itself. That's the only thing that you have to remember when we when you want to achieve a particular goal, try to find out if there's already a function that is provided by the radio programming language that you're using that can do that. I cannot give that particular output just like what we have here. I don't have to define a function that converts a string into an integer because there's already a function that that's that, then it is already provided, but the programming language that you're using, which is Java script in this case, but we are going to do is we're going to find our own functions, like our own costume functions that will behave according to what we wanted to do. So I think what we are going to do is we are going to say we are going to define a function that basically, um counts. What it will do is it will count from 1 to 10 every time you call that function by doing what? What we did hear the part and then the open and toasting for embassies with the same column . In the end, this is something called invoking a function or calling a function or function invocation or a function called Basically, those are the terminology, but it's a function called Basically, you're calling a function that's already been defined. You cannot call a factual if it doesn't exist. It will throw an error like, say, function that that's not exist. So this will throw on error because it's this function that does not exist. It's not defined because it doesn't exist. No, let me just refresh this. Let's we ate our own function. But we will do so great. A function called Count to 10. See what I did there. And what it will do is it will count from 1 to 10 and then just constant love those output . Let let's use the folder count equals one, then comes less than equal to. And yes, plus, then just gonna be, How do you plan then? The cult right there. So now we have a defiant function, and right now it did not do anything right. It's up doing anything at all because that's what functions do. They are basically giving up, ask a role, and then they will do. Once they have been defined is that they will just sit there. They will do. They will have to do anything else unless you tell them to. Hey, do you do your thing? I need you to do your thing because I need you now. And I need you to do this This thing that I assigned you to do so basically that's what functions they don't. They will not perform whatever you assigned them to do immediately after. If they find it, they will just be defined in that they will be ready for it. So now that we have this, that function called count to 10 remember This is the name of the function, and this is how they finally function. First you say function and the link the function. And then we have the opening, closing our practices. And this is the function body, the open and closing curly brace right here. This is a function body. Whatever's inside of this is, uh, private. That function. So basically, dysfunction body has its own thing. He has his own small world, which we will talk more about on later video. No, let's try to call the function count. But then you basically just have to type in the name of the function, followed by an open and closing parentheses. And what they do is it will count from 1 to 10. There we go. It says about 10 123 And so I don't think so. That's what it does. And then what? You can do it. You can again. And then again. And then again and then again and again, basically, you can call count to 10 for a strong one. That's that's that's that's function. They are reducible. Anything that have to do a rewrite. It didn't have the copy basic. You didn't have to do retype it or whatever it's already been defined and only have to do is to use it whenever you like and whenever you need. So that's the advantage of a function. You can call it like this now. But we will do is we will talk about something called of the parameters. Remember, we have all the persistent where possible. That's the part we have this right on past. We have. We gave it on this open and closing calibrates our opening closing practices. We have this string right here. This is called on argument. Okay, that's an argument. But it is that it's an input that you give to the function that you just defined. Or you will call basically what? This is a data input data that will be available, the function. So what we can do is we can actually try and do that by a different. I'm just gonna fresh the beach and then I'm gonna try and go there. And what I would do is I would say limit, Have they finally a constant. I'm gonna fall a limit, and I'm gonna say pen. So if this was here the limit, it's less than or equal to the limit actually let snoops. Let's make it a lift so we can change it later. So now So now what ever do is I receptive to the limit? So what this thing is doing, it is. It's using a ah variable that is external, that is coming from the external off the off the function. Bobby. Basically, we have this function This it's viable right here, and we have this function right, kill and inside the function we have already, it's small. It's on scope, its own little world. And what what it is doing is it's trying to access the limit, which is on the scope, that where the function was defined, it's gonna be valid. It's OK. So in a sense it's kind off using a limb. Put its kind off, using on input to perform what it means to do. So let's try that out now. Got that? Now what it did it is still counting from one. Already do, then is that it's the same. That's before. Now let's change the limit to say Grant, and then it's counted the function again. That's called the function again and now we see that the limit has a big 20 and not counted from one all the way to 20. Know the name of the fashion is misleading because the name of the function is supposed to describe what is the function. But the function is gonna do. That's a naming convention. You're supposed to name your function according to the functionality that it performs. So in this case, our function is basically trying to count from 1 to 10. That was the original fund that was the original functionality. But now it is quiet. Misleading. The name of the function is not misleading. So that other programmers that they took a look at the code and with your code, they see out. Oh, this function is gonna count from 1 to 10 or gonna count to 10. And, um but what the? But it did it discounted from 1 to 20 which is misleading. Now it's going to say now that depended for your teammate is probably going to say, Hey, why is this function counting called down to 10? But it's not counting from after tense counting after 22 it's quite misleading. Now let's buy in, do what they will do is this is not really a good practice as much as possible. What we want to do is we wanna make this limit instead off valuable that was already defined before you call before you pull the function This right here before you called it, it was already defined and initialized value Before you call it, what they will do is we will define it on the moment that you called it. So that's the good thing, because you don't have to rely on something constant, but sometimes it's required that rely on something constant. But in this case, we can use a function argument and function parameters. For that. Let's try fresh stoppage. But there were days where they count found for one, Do you from one to from one actually going from one. So what it will do is it will count from one, and we have this opening closing point is right here than inside of it. Just type in the name of the thing to, and then what you do is you even Steel town say, let politics was 21 and countless less than or equal to Oops. Let's say limit, it's that's renamed that limit and then count bus. And then what do you do here is this concept about love? The count now in the call it we have great toe in something called the Argument. Let's say the 10. So what they did is counting from one Repent. Now let's try that again. It's that this timeless bunch in 20 now it don't get all the way after 20 from one or the rate of 20. Now that's bunch in lifting. And don't get 15 response in 11 but it don't it all the way to 11. So now our function number one is properly named according to the convention, according to what it does. So the moment you see the name of the function, you already know what it is doing. Its counting from one then this is probably the limit to 10 counting from one depend in this case. No, there are a few technologies here in from the perspective, off the function call which we did here. We have the function from here. From this perspective, we call this the input data, asked the argument Now, from the perspective of the function itself, we call this which is the input leader. Ask the barometer, graze a parameter, then arguments parameter argument that study the star just different convention. Different means basically, for the same thing from the from this point of view, it's called parameter. And from this point of view, it's called argument. So, basically, are giving an argument or a data to the function called Count from one. No. What happened here is this. First we defined the function, okay? We defined a function, come from one and defined it with this parameter called limits. And we have a function body. What does he sit downs from one all the way up to the limit that was provided as the input data. And then here we called it. We called the count from one, and he provided then as the input. That's what happened here. Once the function Cole was made, this data here will deceived us. The value off limits. No limit is going to be a variable in this case, Variable. They also look at it as a constant. Since you're not supposed to change whatever data was provided right here, you're not supposed to assign it. You're supposed to use it. It's only an inquiry. So basically this value then will be saved will be stored too. This guy, the variable called limit. Now this violent, this limit is not a viable. And we can use it just like any other valuables. Just like this guy here, just like the count. Basically, we just defined a valuable here. But instead of assigning it a value, we are expecting it to be provided a value from the function for itself. And then you can no use that like we did here with the countless than Khost limit. So that's a parameter. That data that you can use toe do what every or function needs to do. So that's a I promise. And then you're not limited. Right now, we have one parameter, but in reality or not limited to just one parameter or one argument, you can have as many arguments as your function might need, though, if it which a point when it has way too many arguments or too many barometers. Maybe you have to split the functions doing Sometimes it's best to isolate a particular functionality to the function itself, like it should only perform one thing and only that thing nothing else. That's what the function should be if it needs to do something else. You need to define another function for that, for that something else instead of putting it under the function because that's that's the best profits to do it the best way to do it so that the function is going to be isolated. It's gonna be that sort of small and very well defined. So that's why having do two parameters, that's guessing, freshness, pitch. And now what we will do is we equate a function called Count. No, it's just count, and we're going to say start and limit and then what? Here we are going to do for lead count? It was Do, um, start bullet country Just the start and then we have the counter is less equal to the limit counter plus plus, Then you just need console that love count, then content. So now we have to provide dysfunction to two parameters rather to arguments. When we call when we call the function count, we should provide two arguments within arguments to it and the arguments being the 1st 1 is gonna be the start. What is going to be the starting point. Where should we start counting from? Could start counting from one. Should it start counting from Cyril and so on? No, the 2nd 1 The second argument for the second parameter is gonna be the limit. Wrenching the count end? Like at what count should it end, actually, And a 10 and 20 and so on. So that's the two parameters that we have there. Now that's trying Full count. It's provide one by 10 states the count to 10. So now we have one all the way to tend to. It started counting from one, and it starts at 10. Now, let's try providing something else. It's dry. We can stop at seven. Now we have it started counting from three and ended. Stopped counting at seven. So that's what the the parameters do They basically have basically our data input data. I think of them us in the data that their function can, you see in order to perform whatever functionality it needs to perform. Okay, so that's it for this video. Guys, thank you for watching I. And if this is a bit confusing for you, that's okay. Just going and trying to do it practice practice often that will help you out a lot. Especially help out your brain is because it means a lot of input. So thank you for watching and see you on the next video. 13. JS I 13 Function return: Hello, everyone, and welcome to another video on your JavaScript. One course In this video, we are going to talk more about functions. There's more functions than what I could discuss on the last video, which was already taking a long time. So I'm trying. I'm going to try and extend it. So first we are going to have analysis. So what we're doing here used to be our calling function after it has been defined, basically the 1st 1st we did find the function right here on the top. And then after that we called the function, which is right here at the bottom of the definition of the function. The definition is above and the call is below. We called the function after it has been defined. That's what we did here. Now functions are different kind of things. That regular, valuable sort and stuff may think of them as variables. That's that basically signals a particular operation to take place, but they're basically a lot more complicated than variables. The question is on viable say we have a viable, viable, called variable costs one, and then we tried to use the valuable. It worked right. First, we define the viable. Then, after it has been defined, we used the variable. Now let's try freshness Page. What if we first hold or other used a viable before we even defined it? What happened would happen there is that the viable were two an error Because they're viable. That didn't exist. First, we've used it first before it existed. That's the limitation of viable. Where I was should exist first, before you can use them, are the same things through for Constance, Constant should also being hopes. Constants should also be declared first before you can use them. So constants and variables shared that scene. Change that that seem, um, limitation that you have to be or characteristic that you have to do defined them before you can use them. And it makes sense because you first have to define the container, even if it's empty. Before you try and use the container, you can use what's not there, right, but on functions. It's a different thing off because on fashion we can actually call the function first with a mistake there. We could actually call the function first before we can be defined it. So here what I do? Is I replying, called the function first before defining the function till the fashion was defined at at the bottom and the core happened above that definition. Since try this out now we see it worked. Did it through an error didn't toll on air because that's that's a functional, rather a characteristic of factions. What the program does is it compares the function first, unfold it even once the other things which are not function, say variables, calls and stuff. So, basically, if wherever you put the function definition, it's fine because it will be defined first, it will be sort of coral. First, they will always be defined for us, even if you put them on the bottom of your code before you put them before you hold rather before you call them right after content. Um, so that's that's one thing to remember on functions, but it's still a best practice to make sure that your functions are clear, that you have a place where you define them so that other programmers can work with it and work with with Israel, they wouldn't have to sort off scoured and battered good base in order to find a particular function because they know that their funds, their codes, are well organized. So that's one thing to remember. All function you can call them before you define them, unlike in variables where you have to define them before you can use them. Now, fashion's another thing of you to talk about its function. Return. Okay, In our example, what we did here is basically nothing. We just counted and that's it. We counted and we constant drug. That's it. It's it's cold sort of side effect because the function is doing something and not returning the value or the output of its return. There are instances where you'll find yourself doing this and yeah, maybe that's that's okay for some some cases, but much as possible. Your functions should always return a value, which is the result of the operation performed. So we will do is we will try to turn account instead of instead of I see Rajan it they don't need us and the rate so that's not defining function or still count and have start areas to have limit we will do is we will wait a constant well helds and then we're gonna count there's a thought. There is less equal limit, found us plus. But people do is we will push inside of the counts. We will push in a the value of the counter. Then after this, he will return the count's. So that's it. That is the key word here is return. That's the nuclear world with turn means to go back to where you It was cold and then just returned whatever value we have, which is in this case, an array that contains integers, which happens to be there off counting from the start to the limit. Now, if we can do is we can actually wait a valuable they sort and then assigned that what ever is the return value off the count, which we will have a week to 10. So now what will happen? Here's this First, what it will do is it will cool the function count and then give in the three as the start and 10. That's the limit. Then the count will do will do its job. It will perform that they were means to perform, which in this case it will be eight. If the constant called counts which is going to be an array and then it will want a for loop which will go from that start the value that start all the way all the value of the limits which in this case is three and the intent respectively. And then it will intimate that counter by one every time. And then what it will do is it will push, push their value into the count. So the county's array, which is going to be the result which is going to be to contain the count the 3456 and so on. And then after this loop has ended, it will try to return the the count. Sorry, which is going to be there served off this operation right here. Now it after dysfunction has returned, what happens is that it will create a valuable called result. And then there's the the return value. Off count will be assigned to this valuable resource to see that. Excuse me. So what happened here is nothing using nothing, of course, because we're not constant lugging things. So let's try and consular the value off result, which is a viable. So you see count is rather than sort is array, which contains three. All the way to 10 which is the result of the county. You can also try Let's refresh the page. You can also try to once a lug so you can see what actually happens. Rated towns every then here Bush counter. Oh, in the valuable counter is just that. And then with turning counts. And then that's do that. And then look, we are going to do is we're going to try and again wait a valuable corpus and then just in town, I'll say 7 10 this time. So what they did is first hold the the eight did it said Ated counts array, which went to this once a love that means the accounts already has been created. And then it fruit inside of here. The look, it said, push counter accounts, which is seven. So it pushed seven counts and then it closed eight counts and nine counts and pent accounts . Then after the look, it said with turning counts, which is this part right here, it's going to turn the value of counts and then no, they're so we're supposed to be It's gonna be the value or the array off counts. So that's That's the thing that's found Chance treated more often do should return. It should perform an operation and we turned. They're sort off that operation okay, can set input, perform operation and return returns the value of that operation. So bird that in mind, because that's going to be extremely, extremely useful said. Especially for things like this. If we want to save the result of a particular function, you can assign it to a variable or constant if you want. So that's it for this video. Guys, I think this video's getting long to you on the next video, where we will talk more about functions. 14. JS I 14 Anonymous functions, function args, function ret: Hello, everyone. Welcome to this video on your JavaScript tutorial one. In this video, we are going talk about something called Anonymous function. A fashion that doesn't have a name. So on the previous video, we talked about functions and function returns. Now we are going to talk about function it doesn't have made on the previous video. We have name on our function. What we rename them count counter 10 genera, so those functions have needed. But there there would be instances when you don't actually need to give a function a particular name because you only need two years. It's a once that's very useful. In that case, having anonymous function is very useful. So let's get started in this on the first example what people do sweeper a valuable and silently function that viable. Let's wait a viable cold don't valuable and it's, uh, a sign. A viable and we will do is we will accept start and limit, and then again, we'll do what we have been on a video, and then you return the counts away. So what we have here is that we created a fashion, but dysfunction doesn't have a name. However, we want to be able to reuse dysfunction. That's for the sake of example. So what we will do is we will assign dysfunction inside of a valuable so that describable will be able to hold the function and then we will be able to refer or use. And we use the function by using the viable name AST a reference to it. So let's try and do that count account viable starts with 0 to 3. So now you can use the fashion, uh, but doesn't have a name the count the count viable. It's not the name of the function that's not the name of the function That's the name of the viable which has the function, which first to the function. Okay, but this function here is completely anonymous. It doesn't have any names in it. This is useful for passing in, um, functions as argument to a function called. So that's gonna be useful is also useful what we're going to talk about right now, which is something called function with turns rather returning a function inside of a function. So basically what it is is equal a function that inside of that country, really turn another function. That's useful because the function you just return will keep the context of the function that was called. So let's do that by creating a function that basically except a number. Then he turns a function which will add the number which, which will add the number to the number when I was previously provided. So let's do ah function. I do see number one. Then it's returned our function, which in this case is going to be anonymous function. It doesn't have a limited and it's a seven number two as a parameter. So what we will do is return number one plus number two. So basically it will add number one and number two together. So what we can do is we can create a viable no, that's cool Abdu function and let's go by the 10 and then now the valuable it's going to be a function which we can call and provide a number which will return the some off, then in that number so we can fall viable and then say three, see what it will do. What it did is it, uh, at the three to number 10 so it gives us 30 and then we can do that again. We see a different interests. A 14. We can also do five and whatever you got to one. So basically, that's what this business is. It it turns a function and dysfunction. The good thing about it is that it was defined inside of this function. That means dispassion has access to whatever dysfunction has a festive, including number one variable, which is a parameter that way we expect when you call to function. So basically now, number one is going to be sort of a constant for this function by fear. Everything you call this function, the number one is gonna be kept. But the number two is going to change according to the parameter argument was provided. So basically, that's the usefulness of this kind of concept when when you can keep the context off the face of the parent. So that's a useful three quite there, which you'll find very useful when we start holding on app for us so you can return a function inside of a function. Another thing that you can do is you can actually provide a function us an argument. Okay, you can basically pass in right there were just passing in numbers. We've been doing that for quite some time now. We've been passing in numbers as argument to a function, but we can also pass. Um number are functions that argument do function. So it say this. Let's just refresh the page. I copied base that the abdu function, so we will do is we will great another function cold. Get assault. It will accept a function called Operation and we will do if you return the operation. The release called the operation and then provide in whatever the number you see number. So now we have two functions. We have the Abdu function, which returns a fashion which adds number one and number two. Every was provided, and we also have get results function, which except, ah, function as the first argument and a number as the second argument. And then, when it will do is we'll discover the function, the operation and providing the numbers that's relatively simple. A sample is it's not very useful, but it will be just fine for this example. So outlets were a function called good. Oops, that's the ad do and it's provided. Then you know we have a function which is depend. Just start inside of 10. But we can do is we can call the get result in a Scotsman that love that it's Consul that love their sort of get results and let's say and it's provide in five. So what it did is it's called the get results and bust in the function at the pen, which is which Richard, please. She's gonna be this except that the number one is going to be then and then. We also provided five as the second argument. So it will call in the operation which is right here and then providing the number which is not repent and then return that which yields five or other 15. Because in class five is 15. So basically you can we turn a function and you can also pass in a function as a on operating another Asan argument that particular that particular ah function. So that's it for this with you guys and thank you for watching it doesn't make any sense to you this keep going. Like I said, the skip writing codes and you know Lego, it will start making sense to you. Do you guys on the next video 15. JS I 15 Scope: Hello, everyone. Welcome to another video on your JavaScript course. One. In this video, we're going to talk about something called the Scoop. And we have been using scopes ever since you started coding. You're just probably not well aware of it. You're probably not well informed of it, but I have been talking about scope in the previous videos as well. In this video, what we're going to do is we are going to try and explain the scope so that you have a better understanding of what this group is. No, the school will be. Thus something like these a scope tells you or answers the question. Is this particular variable, or is this particular function available for me to use? Begin this, but of the hoods. So basically, that's what scope is. Scope describes the availability inaccessibility off, a viable of function or any particular resource within your codes. So not everything is going to be accessible everywhere in your code. Scoops are very useful to keep your coat styling, so let's say that's great a function all the other. It started with an if statement, so let's so I on doing if and just start being true on the conditions so that the if statement will be executed. Every and then what we will do is try and create a valuable cold. I am a variable and yes, I am. That's the value. And then what you do is you are trying constant love that viable in here I am a variable and then also trying concert Love that variable outside off the else statement body or the if body to make sure I did not just like that. Don't go. So what? I want to take notice. I wanted to take note off the opening and the closing Curly braces This curly braces. They are very useful when describe because they are describing something called the scope they are describing. The scoop every time is the Holy Grace. You should take note of it. It's a scope. OK, every time you have a cold breeze there that a scoop curly brace on a if statement, that's a scoop curly. Brace off the else statement. That's a school. The holy breeze off the function that's also a scope, something still for the four look, why look, develop and everything else that has cola grace in it it's a scope. OK, so upset. Object my degree. But still objects have their own school. That's a different topic. So what we'll do is we'll try and won the schools and you'll see that what happened here is this. The if statement was executed and equated its own middle school. But here, the often and closing curly groups. And then we think that scope we graded a valuable and we called it. I am a valuable any assigned it a value called Yes, I am, which is a string. And then we tried to counsel work that valuable inside off this scope, which we did right here. We tried that out. We tried to execute that tried to access it here on this line of code right here, and it was successful. But this is the result off that line of good. And then when the computer, this line of code to on error, which is this area, it said that the I am a variable. It's not defined because this valuable right here, it's not accessible outside of business. Basically, this valuable only exists. It's only accessible. We think this is scope, so they know that every time you have a curly brace. You do that. You have a Calabrese and you graded a valuable. You do that you have valuable. But the rebel is only accessible within that school. Okay, Always keep that in mind. We can't expect that viable to be accessible outside of that scope. The same is true for the functions and everything else. But you are just using the if statement here, for example, know what this is? Is something called the local school. This is a local scope. That means that this is scope. It's local to itself. Everything else outside the field can have access all the resources declared inside of it. So that's one of the things that you should remember about global scope. They are not, um, accessible. Everything else that's outside of it. Now the thing about scope is not big. Can they can They can nest. They can be nested. You can have a scope inside a scoop inside a scoop inside a scope. So basically scoops can get layered. It can be we could have ah, school and then inside of that scope even have another school because the inner layer you can have another school inside of it. That's gonna be now the inner layer and so on and so forth all the way also ask you to. But depending on the problem you are solving, and then always keep in mind that the inner scope always have access to the resources of the outermost scope. That means everything. The scope sort off the king. It has access on everything that's that came before it. So we have that again, if else statement. And we have another GIF statement right here and we have another school. But that scope right there and it's trust Type two through through here, and it's driving access that's viable. The I am a viable first layer. That's a second there, and what will happen here is that the second there will still be able to access this. The resource is off the first layer. It's no, it's his first layer and says, Yes, I am just the value of the I am valuable and second layer. It says Yes, I am. He's the value of the I am variable. So the inner layer, because this guy has access to be outside there, which is this guy it has. That's the pattern about scoops the innermost layer will always have access to the resource is off the outermost layer. Okay, but but here's the deal. Hey, here's that catch. The outermost layer doesn't have access to the innermost layer. That means if I have a variable here, If I did find out of valuable here, So, um, I and yep, and we tried to access that outside of the scope. You'll see that has been stolen era as well. You know, it says so. I it's not defined. This guy right here, it's not defined, even though we define it right here. Well, that's because of the scope. We have the opening and closing curly Brace. And like I said, the opening and closing calibrates they indicate a school. Okay, that makes this particular viable. This particular resource is only accessible within this school right here. The first order, the second layer, but the first layer with just this guy that it have access and the resource defined inside the second layer. So the outermost there doesn't have assets toe anything they find within the first order. The innermost layer. Okay, but the innermost layer has access to anything defined on the outermost layer. That's one more thing to remember now. What if we define the fashion inside of a school? Well, let's try that out. That's defining function. Say, there's folk. Do you think this dysfunction be available outside this guy? Well, yes, it is. That's because all functions are inside a functional scope. Every function that defined is going to be defined inside something called the Functional School. We have been talking about the local scope, which is this guy right here. But every time we defining function, that function is going to be accessible inside, off the off the, um off the anywhere, Basically, that that function is going to be accessible anywhere. That's because it's going to be stored inside something called the functional scoop. The functional scope contains the record off all the functions which are defined, which were defined in your code. So all the functions that you defined there were restored on that on that scope, and therefore it will be available everywhere in anywhere. So that's the difference between function and scope. But there's also one more thing to remember. We need to remember something called the global School. We can define our resource inside a block inside, they block this thing right here is called a block. That's that's a block. We can define it inside of the block, but we can define it as global. That means it's be it's going to be accessible outside of that scope. We can do that by doing the barkeeper by using the marquee word. So let's say far by Google Louisville viable. So what's gonna happen here is that it's not gonna do on error, but instead the world. But my global variable is going to be defined. That's because we use the Barkey. Would the Barkey would will create a resource which is going to be stored inside a global scope. That means it will be available anywhere and everywhere, even if it's inside a second layer. That's necessary. Fresh cabbage and let's have another layer. If if no, this is another layer of if, but they know that is still available. That's because he used the party with the marquee Word will create a variable or a resource , which goes, which is going to be accessible on the global scope. It's going to be accessible anywhere and everywhere, so in to recap. We have something called the local school. We have something called the Functional School, and we have something called De of the Global School. So these are the main three things that you have to remember. You have to remember a functional scope in a global scope. In a local in a local school, a local school describes This describes a resource which is only accessible within that school. Now a functional scope describes all the functions which were defined on your Good God This affair. They are, however, the global scope defines all the resource which is accessible outside, off the are rather outside, off any scope or inside of any school. It's accessible anywhere and everywhere. But there's a catch. There's a catch again, another touch, and that's with the functions. The fashion's great. They're only the world. Degrade their own little major big scope. So if you have a function, did this and we define a global function right here. Let's run that this. You know, you're going to expect that there's a global function, a variable, my global, but there isn't there is not. There's not going to be a my global viable, even though we used of our keyword. And the reason for this is because functions are kind of special. Every time you create a function, you create a small, tiny little world which has its own global scope. It has its own thing. Once the function has finished executing, everything about it will be scrapped. Everything about its scope will be scrapped. All the my global in the, uh, my global and you can also define a function inside of you that's right in defiantly function. But it's just why and one sold up love something here. You know, that's tried to run this, but the best ones not going to be available for us this is because this guy was defined inside of the test off the dysfunction. That's one thing. Okay, you have to remember that every function you create every function has its own little global scope. And once that function has finished running, it has finished executing its code. That scope will be scrapped out. It will be deleted, it will be removed. So that's one thing to keep in mind. And that's it for this video. Guys, Thank you for watching. I hope that scope you have more idea about this and why it matters and why it is very important for us to remember. So in the future videos, you will be able to use these ideas this information, so just keep going and keep moving, see on the next video. 16. JS I 16 Reference error, syntax error, try catch, throw: Hello, everyone, and welcome to another video on your JavaScript course. One. In this video, we are going to talk about errors and how to handle them also what they mean. So, first off, let's talk about something called the C Max errors in the previous videos. I believe we have encountered some of these errors, but the two of them. So let's start with something called a syntax error. Syntax error. BC doing the same with a grammatical error. So when you commit a grammatical error basically means that there is something wrong with the construction of the sentence that, um, makes it hard to understand. For other people. Okay, they just don't don't follow the scene that's of off that particular language, whether the English or whatever language you are using to that's grammatical error. The same thing is true for syntax errors, syntax errors means that there is something wrong with the construction of your code, like the pilot does not understand it. So what happens is it stops running the program, and then it throws on error. But throwing on error means that you will see something here, a message and then it's been read to that story on error. It could throw an error right there and you could actually see it. He could be able to correct it, in fact, so let's try our backs error. So first, let's do, um, that's next. Commit a sin tax. So whatever these, I'm gonna try and create a variable called 123 and assigning a value. Best as you know, this is against the rules off creating variables and therefore what happened is the compiler or the interpreter. Well, throw an error and stop running the program. And there you go. You got yourself a syntax error and says unexpected number. So basically the syntax errors telling me that Hey, there's something wrong with your coat. You violated a particular rule. Now I don't understand it, so please correct it. So that's what syntax errors are. And there are many ways you can get in tax arrows like, for example, if you try to limit. So I don't meet the open and close. All right, this is here. And then he said, and then you run it to see you get this a syntax error because noble and trust purposes is actually required. It's required that you use that So not following the rules gets us syntax. Error. Okay, so that's what syntax errors are. They are. There's something wrong with the construction of your good and therefore that's what one thing that you have to look at and then correct. And then one thing to note about syntax errors is that there are actually some things which are seemingly incorrect but actually valid. For example, here I only did the opening close parentheses. What I can actually do, however, is Mitt, the opening close curly breeze, and it is a valid code. Then that's a valid code. See, right there, that's a value code. Run it run completely And it went, say hello and in a stolen error, that's a valid talk right there. You can omit the open and close curly braces, and also you can commit the the, um, the semi colons as well. It will also work to still work. Okay, Even if you are made Holy Breezes, you can have multiple lines without Tolliver's. OK, so clearly braces. I mean, whether curly braces are optional, but not always, and also, um, the sandy gravel there completely optional, but also not always, depending on depending on the instance. There are instances when Sami Carbon is quite like, for example, if you're trying to this, No, that's a syntax error, but you can do that the same equivalence. See if you had to send me calling there and that works. So that's an instance when Senate caller is required if you want to put things in one line , which is very useful, and we do that a lot in JavaScript. So Sammy Colin isn't quite for that, for that matter. And then let's talk about something called the reference error. I believe you have encountered this error in the previous videos. A reference error means that you are trying to access your trying to use a particular resource, a valuable of function, constant anything, whatever. You're trying to use that, but it does not exist. Let's try and do that. This its first waiting, viable for my name. It's this assigned a value of April and then let's try and use that by just logging it. Now you you're able to use it. But if you try and do something that does not exist, no, that's gonna throw our friends error because this thing. It does not exist. It's it was not defined. It's not exist. It's not defined. So that's telling you that Hey, this we can't find this. You told us to use this, that we can find it. Can you please fix that? That's what this is. This is trying to tell them you're trying to access a particular resource, but it does not exist. OK, so when you experience a reference air, maybe you there's something wrong with the scope. You're trying to assume that particular research available is available on that school, but it's not. So that's one thing that you should keep in mind should look at, but you are trying to access and where you are trying to access it, and also when you are trying to access it. Okay, it's important to do those kind of things to do the kind of checks when you experience these errors. But I think I spent passes value coding skills will increase, and these errors would actually just automatically become because your brain with just a bacteria so and stop that hard to handle errors. Unfortunately, we can't handle syntax errors. Now let's try to handle reference airs first. So you have a point of reference. It's dry. We can handle errors, by the way, by using something from the dry catch, try, catch. And this one of SEF's Bible here. Now, try catch allows you to handle some errors, but not for errors. So let's try and do a console that love start the reference era. Something that does not exist. Concerned that love I club. Uh, there you go. So no, it did not throw one. Ever accept what happened is that this guy encountered on error and then it went here. It stopped executing this plan off code and went immediately this block off. Good. And then this one contains the information about the error. You can actually consul love that part. So it's trying concert like that. You see that it is the error message. Well, a string it isn't. There a message. And then what happens is that instead of Bud Light ever stop, you're going from wanting, right? So say you have one. So that luck here hopes, but and then you experienced on error right here. What's gonna happen, man? Sorry about that. Some thing what's gonna happen is that it's gonna stop running in this part of good right here Will not Will not be run. Okay, So what happened is that the hello was one again with success will find. But this guy in foundered on a row, and then the computer program just stopped executing from there. This one must never executed. You actually don't want that to happen. Especially have in production because it's a bad user experience. You have to handle errors as smoothly as possible. In fact, so try catch was designed to do just that allows you to handle errors as smoothly as possible. That's what happens. What happens here is that it's drought and do that here. So that would be hello. And then when? So that love the there, right here and then here and say something went well. Please try again. Enter and you see that said him. Oh, it won this file this line of code right here And it was fine. It was good, but it ran the sign of court right here. And then it encountered an error. And what it did this is Stop executing this lying this stuff, executing this block here, ignoring the rest of the goats in the block. This guy right here and there it went directly here and then tried to execute every inside the try catch. In our case, it's just a constant love that say something went wrong. Please try again. And in the the e which is the reference or the valuable holding the information about the error. But know what's gonna happen if the try catch did not encounter any air that's tried that. So what happens? We try cash is that if the try block that while block right here did not encounter any firm off errors, what's going to happen is that the catch will not will not ever be run like ever. Like, totally it will not be run. It will be word and then it will proceed to whatever come snakes after the try catch block sweets. That's why. Do something like, um, after dry touch that says after try catch. This block right here was completely ignored after the try was done doing its thing. Okay, so that's that twice. Catch, look, and then strike. That is also useful when you want the drohan error. Uh, what? No yard. Basically given errors right, the interpreter. The batter is throwing error our face, but they can also 12 errors ourselves. This is very useful, especially for libraries. They use this a lot. So what you do is you try and do a function that's great. They functions. They throw arrow, throw you error. That's a I am on air. Let's do that now That's trying. Throw on error. What's gonna happen? That it's gonna through a narrow and the error is just got error. It doesn't have any name in it, which is just got there. And then it shows you the message, which you put right here inside the first parameter for the first argument. Okay, so you can throw one air and you can also put these errors inside the try catch. It will be handled, um, accordingly. It's dry that out right here, and it's do that. Something went well. Don't say something went from Children. Error. It went to the right, went to the catch and then it's finished. So that's what happened there. Okay, so you can tow there. That's useful for, say, for invalidation the users trying to log in their instances when you can turn on error on and then had all that energy to say. Hey, your user name and password is incorrect. Please try again. Or other police. Greg, something like that basically allows you to have the user input errors, Um, in in a smooth way. Okay, So it's important to know that you are. You can tell on error. You can also experience error friends air, which are most likely going to be removed from your head. And then once you are still programming skills never loved. And then you can handle errors using quite catch. And then also a rest. Stop your court from running, Okay? They stop. You're going from further executing. And so that's yet for this video. Guys, Thank you for watching and see you on the next one.