 Hi and welcome. This is Christian. In this video, I'm going to show you how to create a variable in JavaScript using that four, or eight, or even 10, but 12 ways. Yes, 12 ways. Maybe 14 if you count the last two, which I'll show you in a minute. And so you know for a fact that this is not possible in Java or C++ or PHP, for the matter, you can do maybe like two, two, four ways to do that. But in JavaScript, you can do that many and probably more. Okay. So you may wonder why? Well, it's because you can. And how is this possible? Or maybe because the way JavaScript was designed. As you know, JavaScript is not a class-based language. It's an object-based or sometimes referred to as a prototype-based language. So through its prototype chain, you're allowed or you're able to create all sorts of variables and properties in very different ways. So in this video, I'm going to show you how to do that. So if you're ready, let's go and take a look. Okay. Before we start, I want to explain literally here on the right side is the console, on the browser console. On the left side is the code. I created a variable called data. This is going to be an array or list of data. We're going to store each value of the variable we're going to create into and push that into the data. So when we print that out, if I save, now it will show up live on the browser side. And the first index zero, I'm just going to put that here. So it will offset the index count. So when it count from one all the way to 12, okay, for each type. So number one, let. Let was introduced in ES6 that allows you to create a block scope variable. You can push the variable A to the list. Save it. And there it is. Move on to number two. Const was also introduced in ES6, allows you to create a variable that will make it constant so you cannot be reassigned. I'm going to add B to the list. Save it. There it is. Number three, var. Var has a function or local scope. Add C to the list down here. Save it. And there it is. Number four, I used the global method. That means it's nothing attached to the variable in the beginning. So just use like D is equal to dawn. And we'll pass that to the list down here. Save. And there it is. Number five, use the global this keyword. You attach a property variable to the global this assigned that with the data called Eli. Then this E becomes a variable. Access it. So and save it. And there it is. Number six, use this keyword. Same as the global this, this F is equal to the owner. Access the variable F just like normally. And then there it is. Number seven, using the window object or keyword. Guys. And we add G to the list. As you can see, just a regular variable. And there it is. Number eight, we use the windows constructors prototype property. Window constructor prototype. And then the variable name will be like H equals to Helen. And we add H to the list down here. You can see you can access the H variable just like the regular variable. And there it is. Number nine, kind of similar to the window. This time use this as a number eight. So this that constructor that prototype that I assigned with the name each row. Add the variable I to the list. As you can see, save it. And there it is. Number 10, we're going to use the objects, the global objects. I can spell this correctly. A prototype property J say equal to Jasmine. We added the variable J to the list. You can see. And there it is. Number 11, I'm going to use the object instance, proto property, the to underscore. Okay. So to do that, I'm going to create a constant call OBJ equal to the new object using the new keyword to create an object. And then I'm going to access the OBJ, which is the instance underscore dot underscore score proto underscore underscore and attach a variable K and assign that with the name Kyle. And now you can use the variable K just like any variable here. And there it is. The alternative way to do this is you can also use the literal method. So let me go back and redo this. I can do something that is cost constant OBJ equals to the object using the literal object notation. And it should still also work. As you can see, if I save it, it still shows up here correctly. And finally, number 12, we use the object literal proto kind of similar to number 11, a little bit different, but here we go. So wrap in the parentheses, I'm going to instantiate a new object that way. And then dot underscore underscore proto underscore score dot the variable name in this case, it'll be L is equal to Lana. And you can access L just like any variable. Here, add it to the list. And there is 12. Alternatively, you could use the literal notation as well. So let's go back and turn this off and go down here and create again inside the parentheses, make sure you put that in parentheses, then the paracolor braces, right, that's object notation. And then dot underscore score proto. And then if I put L again, equals Lana, save it, add, really add it. So save it. And there it is. So there it is, folks, there are 12 ways or rather 14 ways how to create a variable in JavaScript. Some people love it, some hate it, you decide. So thank you so much and have a good day.