WEBVTT 00:05.960 --> 00:13.310 In this video you're going to learn read only variables in E6 or what we call constants so a constant 00:13.670 --> 00:17.950 is a variable thus can most be reassigned a new value. 00:17.960 --> 00:26.150 Once you define it so as to create constants you use the keyword constants and then you choose a name 00:26.150 --> 00:27.540 for your variable. 00:27.620 --> 00:31.650 Usually you find these variables in uppercase. 00:31.700 --> 00:36.600 Now if you just declare the variable without initializing it you're gonna get an error. 00:37.370 --> 00:42.680 So you really need to initialize its streets after declaration. 00:42.680 --> 00:45.690 So let's set this variable to up. 00:46.300 --> 00:47.000 So if you log 00:49.710 --> 00:53.680 make you're gonna get apple now. 00:54.820 --> 01:02.950 If you try to assign a new value to make like something then you're gonna get an error because as we 01:02.950 --> 01:07.450 said these variables are constants so they cannot be reassigned. 01:07.450 --> 01:14.160 New values now constants just like lets variables they are block skipped. 01:14.200 --> 01:24.580 So if you create separate blocks and you read declare your constants 01:27.500 --> 01:33.390 in these scopes then this is not going to cause any error because they are block skipped. 01:33.640 --> 01:44.330 Now a quick challenge for you let's set a constant to a value which is gonna be an object so let's call 01:44.330 --> 01:45.080 it what language 01:48.560 --> 01:50.170 and let's say about. 01:50.450 --> 01:52.160 He's gonna have a couple of properties. 01:52.160 --> 02:03.290 So the name javascript and a version is five. 02:03.760 --> 02:06.850 So now we know that this is a constant. 02:06.940 --> 02:10.360 So you cannot assign a new value to it. 02:10.360 --> 02:22.660 But what if you assign a new value to one of its properties so let's change the Virgin to 6 for example. 02:22.660 --> 02:25.580 Do you think this is gonna cause an error. 02:25.580 --> 02:28.680 Well let's find out. 02:29.160 --> 02:32.030 So this is working just fine. 02:32.660 --> 02:34.710 You will get an error. 02:35.720 --> 02:41.000 Only if you do language equals something. 02:41.100 --> 02:49.390 So you're you're actually reassigning or assigning a new value to the constants itself instead of the 02:49.420 --> 02:52.460 properties of the object. 02:52.540 --> 02:53.600 All right. 02:53.920 --> 03:05.080 So now the good practice in E6 is to use constants all the time unless you are looping or need reassigned. 03:05.100 --> 03:10.600 So in my case you use let me it's okay to use var if you wish. 03:10.720 --> 03:14.780 It's a good proxy to use constants or variables that don't change.