What is cost keyword & cost reference in JavaScript?

Let’s talk about cost keyword cost reference and the property value can be changed So if we talk about constant variables right when When I define something with the help of cost Okay let’s suppose we define courts do not change 10 Okay so now this variable cannot be reinitialized as we saw earlier right We cannot reinitialize this right It will throw an error But when I define the constant object it’s property can be changed if you see cons object We don’t know about Constant We don’t about objects yet but a little off idea later we will cover this thing.


The object is equal to the name Jimmy So there’s a property name that is equal to Jimmy on Now what we did we just manipulated this object We added one more property that is age equal to 23 Now we again change the name to Jim So when I try to print this object okay it will give us name equal to Jim Right There’s a name property which has a value Jim on ages 23 now since these properties can be changed But when I tried to change the reference of this that object equal to Jimmy tried toe make this object as string right equal Jimmy it through an error Right assignment Toe constant variable is not possible We have reinitializing it.

When I in the second image that is on the right-hand side of your screen that wants to not change equal to 10 then I’m trying to change that do not change 108 Children Error assignment Constant variable is not possible Okay this is all about Constant arrived now before jumping in tow there types Let’s see the demo of this constant very quickly Okay Now let’s see the constant now What do you mean by this thing is constantly equal to 10 Now let’s suppose I try to reinitialize it 100 Now it will throw an error Okay Because I have to find it I cannot reinitialize it, Okay It’s one once Once it is initialized It cannot be re-initialize Now let’s see the error Identify A has already been declared Right So it was declared It has been declared again okay maybe this is some other area that we’re getting Yeah because we’re helping Chill Sized it here OK we saw this thing.

Let’s say this thing because we were too declaring the error was different right And is not defined Right We saw and is not defined one minute again Yeah this is there and is going to find Now let’s see this thing again You see reading errors is very important right now You see assignment to a constant variable is not possible Right So this is all about constant Now let’s talk about data types So data types JavaScript is dynamically typed right We saw there’s no specific type-specific data type that you have tow explicitly Tell the jay’s engine right If you use their name equal to face on it will automatically think that it’s the string.

If you use their name equal to Ted it will automatically think that this is a number right So now what are these data types It does not need to specifydatatypee explicitly off the variable at the time of declaration Okay Data types are divided into two broad categories that are primitive on nonprimitive Now let’s see What are the primitive data arrives first One is a number So if you define something we’re equal to 23 So this is a number If you define where to be equal toe What for 44.66 Right So this is again a floating-point number but it falls under the number category so indigenous and floating-point numbers fall in the number data type Currently.

Now if you see where c equal toe 34 it is again What a negative number But again it falls in the naked What a number category So this is the first data type Write the number Now let’s see the second data type We will see how many primitive data types out there and how many non permitted data types out there okay now let’s talk about strength So the string is a sequence of characters as we all know right So if you see where s one equals Hello World is the strange right Now if you see this where s one equals Hello world.

This is a strength When you try to control When you try to print it will show us their hello world Now where’s two is again What a string wherein we have again to find Hello world Now where age is equal to 20 on Then we try to print this thing right Alex is thesis something that with which we can print this thing okay, so Alex is dollar sign on then These girly break braces This will just give us the things will just treat this thing as a string right there are three ways with which we can just print out the string We can also use Alex Is that plus sign then dollar then the age Okay that can be done Or we can use it in with the help of this Chinookan control all of history It gives Alex is equal to 20 Alex is 20 The age of Alex.

Before moving to bullion let me just quickly show you the devil part of it Now let’s go to the console and try to figure out the things there So if you see where an equal toe end right now if we try toe Okay where has Bean Okay let’s clear this thing first On Since we have errors from the file they try to remove those as well Since we were trying to do this thing, Okay Now let’s say this fight and let’s go back to this thing just coming in Yeah So now if you do were equal to 10 Right We saw this thing Now if you try toe has Bean already care Okay off the file Okay Put so were toilet’s say ABC equal to 10 Okay now variable has been cleared If we write type off A so it will give us a type So a number Right We saw that if we do where equal to minus 10.


It is equal to minus stands Then we tried tripe off ABC What is its number again So when we do type off 10.999 then type off ABC It’s again a number Now we saw string How we declare a string where name it’s supposed name equal Do right It’s supposed g pg R mm strength Now if we do type off this name it should give us the strength Right My name is a string, Okay Now let’s try to bring this thing that I told you there are 23 ways of which we can bring this string Okay now let’s try to do that thing in the file okay The external file that we have created Okay Now let’s define where the egg will do.

Let’s suppose Let’s name it Kazan Okay Now let’s try to print some things with it okay The first way with you she can print this on the screen is controlled or log And then what I do build right as let’s suppose name plus equal look in the strength FAZ on is 24 24 years What is 24 years old Okay, so this is the first thing then the second thing with which we can do this thing is this thing controlled our law And this is something that will be present on the tab button right in the number Not know it will be present Some somewhere on the keyboard where you have not signed.

You will write this thing when you shift it and when you just press it you will get this thing, Okay Now you will just write this dollar signed Then you will just bring your name okay without using them Graduation operator is 24 He is So you see the different ways with which you can print the strength You see earlier what we did We use concatenation operation But with the help of this dollar sign and these curly braces, we’ll get the same result Okay so now let’s move this thing because it will say that has been already defining him.

Leave a Comment