Okay then, my friend. So far we've seen two different data types, numbers and strings. Now I'd like to talk about arrays which aren't a new data type in themselves. They fall under the object data type right here. Okay, so we typically use arrays to store collections of things in like a collection of strings or a collection of numbers, something like that. So let's do a few different examples. I'm going to create a variable called ninjas, and I'm going to set it equal to a new array. And the way we do this is by using square brackets. Okay, This is array syntax. Now, inside this array, I want to have maybe three different strings, three different names that are all ninjas. So I could create the first one. I'll say Sean, then I want to add another. So I do a comma and I say Ryu, then another. So I say comma and then chun-li. Now I don't need a comma after the last one, but if I wanted to add another, I just comma separate them all like that. So that then my friends, is an array with three elements or three values inside it. We've stored all of those three values inside one single variable. So you can probably see already why these are useful for storing collections of data that relate to each other. Okay, so let's see what happens if we log this to the console console dot log ninjas. Okay, save that and view it. And we can see this right here, this array. Cool. All right, then. So what if we wanted to get just one of these items? Well, we could use square bracket notation so I could say number one inside. And we did this kind of thing with strings when we wanted to get the first position in a string or the seventh position in a string. This is me saying I want to get the first position in the array. And by first I don't mean the actual first, I mean position one, because remember, JavaScript is a zero based language. We start at zero, then one, then two and so forth. So this right here is saying, get the second element. So zero one it should be right. So if we save this we should see Ryu in the console, which we do. Cool. Now then what if I wanted to maybe override one of these positions, say I want to override position one with a new value? Well, I could say something like ninjas and then position one the same way we get that value. But this time I'm going to set it equal to something new. I'm going to set it equal to Ken. So save this and this time when we log it to the console, it should be Ken and not Ryu. So that's how we override certain values in different positions inside the array. Okay, cool. Let's do another example. I'm going to create a new array. This one is going to be called ages and set this equal to 20, 25, 30 and 35. Okay, so we have this array of ages. Now, what I'd like to do is just output the third position. So that would be position two. So we'll say console dot log and we'll say ages and position two. This should be 30. Save it. And we can see that right there. So I just created this to show you that we can store different data types inside arrays. These are numbers. These are strings. We're not limited to storing one particular type of data. And if we wanted to, we could mix it up a little bit. We could say something like this. We could say let random equal to Sean for the first element, then we'll do Crystal for the second element, Then for the third element, we'll say 30, then 20. So we're storing two different types inside the same array. Now that might not make much sense because I think arrays should store data which belongs together and these don't really belong together, but we can still do it. There's nothing wrong with doing it. So let's log this to the console. Random. This will absolutely work and we see the array right here. Okay. Now arrays like strings and like numbers. They have properties and methods. So let's have a look at some of those. I'm going to comment this out and I'm going to comment this out as well. In fact, let's have a look at the length property. So let's say console dot log and we'll say ninjas dot length like so. And lo and behold, this is going to output three because it counts how many elements are inside that array and it counts them. That is the length of an array. How many elements are inside it? Okay, cool. So let's move on to some of the array methods. So I'm just going to do another comment down here that says array methods and underneath I'm going to do a few different methods. So first of all, let result equal to ninjas. And what I'm going to do is use a method called join and I'm going to join with a comma. So what this does is take an array ninjas in this case. Joins all the elements inside them into a single string and it joins them with a comma. So after every individual element inside the string, we're going to get a comma. So let me save this preview. Oops, We need to log it to the console. First of all, console dot log the result, save it preview and we can see the string now is joined all of the elements together with a comma in between them. If I change this to something like a dash or hyphen, then it's going to change this to a hyphen as well. Now this hyphen was already part of the name, so don't get confused there. It's only these two hyphens which we've added when we've joined them together in a string. So that's the first method. Now, let me show you another one again. I'm going to say let result equal to something this time. Ninjas dot index of. And then we're going to pass in one of the values. So if I pass in Chun-li, for example, it's going to get me the index of this value inside the array. So again, I'll log in the results of the console. If I save it, we can see number two, that is the index 012. Makes sense. Okay, cool. So that's another method. Let's do another. We'll say let result equal to ninjas and we're going to use a method called concat. And what concat does is take our array and it concatenate another array with it. Okay. So if we want to join two arrays together, we use the concat method. Remember, concatenation is joining things together. So I'm taking this array and I'm going to concatenate it with a new array which we pass through as an argument to this method. So just pass an array directly into this method and in here we'll do two different values can and we'll do crystal like so, and we're logging the result to the console. So it should be this concatenated with this array right here in one big array. So let's see. Yeah, we can see that we have five elements inside this array now. All here. Cool. Okay, so another method we can use is the push method. So let me say let result equal to ninjas dot push. And what the push method does is push on a new value onto the array right here. Okay. So I'm going to push on a new value, Ken and save this. So if I save it like that and look over here, we can see we get four back. Now, what this method does is return the length of the new array. Okay? So when we're logging it to the console, it's logging the new length. And since we've just added one, it will be four now because it was three before. But if now we log out ninjas instead and save it, we can see we now have four. And so, you know, before when I said that some methods don't alter the original value, well, some methods do, and this is one of them. It alters the original value. And for that reason we call it a destructive method. It doesn't really destroy it, but it changes it. Okay, so then we can also do something called ninjas dot pop. So I'm going to say let result equal to ninjas dot pop. And again, this is destructive. It changes the original value. And what pop does is take off the end value. So we've just added Ken on, but now we're taking it back off. So when we output it, we should just get the original array, save it and we get result has already been defined, so we'll just take off. Let's save it. And we can see now we get the original array because we popped off. Ken Now what this method does right here is return the value. It popped off the array. So if I output now results, we should get Ken because that's the value that was last in the array that we then pop off and it returns that value. So let's have a look and voila, we get Ken. So there we go, my friends. That's the basics of arrays. We'll be using them a lot later in the course when we start to work with data collections and loops to output templates to the browser.