Welcome to this selector this Lexi's Assad lecture on the keyboard which is led keyboard and concert
to cure.
So first of all let's see about the late keyboard.
So my script which is to over 1 5 which was the upgrade on 2015.
In my script is the company or basically organization that is responsible for upgrading or updating
the content of the javascript so they introduced a two important keyword which is that's always good
keywords.
And that was led in a const.
And first of all let's see about the lead in this Alexa.
So these two keywords provide the blocking scope variables and the constant in the javascript.
So first of all let's see something about the scope.
So let me this row on my.
That is inspect element over here and on the console.
Let me just quickly clear this and now let me show you.
Let me just clear some variables so you know how to create a variable which is basically with the VOD
keyword.
And let me just give the name A is the car name over here.
And let me just run this.
And now when I just create the function and it will be my name method and here you can simply go down
in here if you just see this virus can be accessible inside these funds and because this has the globally
scope so when as a sick unsold log and give the car name and this let me close this down and go here
and now and I just call my name which is the method then you could quickly see here it was this log
dot com name which is moderately but what you can do now is instead of creating these funds and are
basically this variable let me create the variable same variable with the late cured.
So this led cured was designed by DEC my script in 2012.
So let's see how this late keyboard runs.
So let me just run this quickly.
Now you could see here this little cure is saying that it has the syntax better because we can't just
3D declare the variable which was created with the vial with this late.
So let me the script the end order that would be Ga.
And let me just press into now.
Our car is great.
Let me just make use of the same method which we just created over here and now instead of car name
a classic car which is our this late variable which is basically the car.
So now let me simply run this.
Now it's time to call this method which is my name and let's see what happens.
So if I just read this then it could sue you that it is suing Maruti is this late keyword has some of
these scoop but now let's do different like let me just create our own block and let me show you something
now sort of way over here.
So when there's a split in the X anyway I just create 2 which is the variable.
Let me just create this yucks variable now fade into it to see undefined is useful but when I just say
yuks it should be small x and you could see X is not defined over here you can simply see that we just
created the variable x with the value of two and when as print DC X outside of this is scope it is not
visible that means it is only visible inside this scope.
You can just make use of this x variable inside this block not outside of this block but if we just
seem when I just create the same variable with the VAR keyword and let me this close my scope first
and if I just sit on the exec in then I could see to the spring to because it was created with the vida
keyboard so I knew the script divide cured are basically the variable with the virus cure it will have
the global in scope that means it will be visible outside of these scope to that means you have to over
here and it will be visible outside to so let me just show you something the example quick example over
here so I was first so I'll say first that create the variable that is extend and let's make this a
scope and make use of late cured and at least say over here and you could see we have now created the
same very relax outside of this blog and inside of this blog I have created links as a too.
So if I just print x you do this.
Give 10 but not two because this little keyboard will create the variable that will be valid inside
this scope but var will create the variable of the globally scope that will be visible outside of this
block also.
But if we make the variable delayed cured it will be visible only inside this scope and it won't be
visible outside this scope which is basically outside this block of accord.
So let's see now that another key word which is can stick cured.
So a very well defined with the const keyword behave like same is a lit variable which we just created
over here.
Except they cannot be reassigned.
So let's take some quick example what I'm talking about.
So the this concept.
So if we just see that later was the keyword which was responsible for creating the variable like the
VAR cure and cost cure will also create the variable.
So I'll just say bye because bio is a constant.
So this at three point 1 4 and it was something like 1 5.
So I just remember this much value for the price.
Well the seed into now if I just reassign these by value to something maybe three point one nine.
So if I say three point one nine is the new by value it will say it ought to be a sign because const
is not assigning below reassign it will it will be only the usable.
That means when I just do another operation with the PI let me say I'll just say I have to change the
value of pi by doing some operation let me say I want to add 10 to this by.
It is also not valid because this variable with the cons skewered is always the constant you can't change
the value of this constant it will be only usable.
So if I just make use up by it is valid.
So if you want to make use of this by you can make use of this but you can't change the value of pi
you can do something like If you want to do the sum you can just to like 10 plus and the PI it is valid
and you can see we are getting some value but if you do something like by and by plus 10 with inhere
you are changing the value of constant it is not possible you can only use the value of constant but
you can sense.
So it was the new keyword that was assigned or introduced by the my script which was responsible for
upgrading the content of the javascript in 2015.
So it is useful example of the late keyword in the Constitution which is also doing the same tax but
in a different manner to create the variables in the javascript.
So this will be read for this Lexus soon the next one.