What's up, everyone?
Today, we're going to learn about variable type coercion and mediation.
So these are very important aspects of JavaScript language basics right now, what coercion and mutation
means.
Sorry about this.
I'm just going to wait here to open this one now.
What I'm going to do is actually we are going to put it here and say variable type coercion and mutation.
Very good.
Now you hit it, right?
No.
That's it.
Now we're going to do we do have the first name and I'm not going to comment on this one, but we can
comment on all of this.
So if I refresh, I'm not going to I'm going to be hello world from external file.
That's one from here.
And that's all good.
I don't have to be worried about that.
So you can comment the section of the code like this.
And that is what also comments are therefore.
So not just to make a comment about what you what your coat will be about.
And also sometimes you need to comment on things in order to continue working on something else.
Nice.
So what is type coersion?
So we have the first name, we have the last name.
And what we can do here is we can just put those together like in one.
I'm not I'm just going to say Konz a lot.
Guns a lot, and I am going to join the EU first name, so how we can join the things, we can join
the things with the plus symbols.
So this is not addition here.
Underscore last night.
Right.
So if I do it like this, so this is not going to be a first name plus last name, it will be joined
actually.
I will have Peter Collins.
Now, what about this very type conversion, what we can do after the plus symbol?
What I would always do, I will leave a space like that and I will need to concatenate again with the
plus symbol.
So it will be first name space last night.
So they're all they're old now.
Transfer or let's say not transferred is not good work.
So they're all now considered as a sphinx because first time hold strings.
This one is considered a space of the string and this one is a string.
Now, we do have these old.
So what we can do, we can just create additional work here and C plus old.
So Peter Collins is.
Speace plus, so we need to congratulate again.
So now I would like to see Peter Cullen is 33 years and we can just again attach or concatenate something
else years old like this.
Let's check it out now.
So Peter Collins is 33 years old.
So what I did have I have a mixed type of variables.
One, it's holding a number like thirty three, which hold integer number, the other one that hold
string.
So that is how we can join this together.
That is how it's called type Hershon.
Now, one more thing before we go so we can be clear.
So remember, we declare one by one here variables we can declare.
In one line, certain variables, first, variable, second, third and fourth right now.
So I have this right here, so third, fourth, so I save it and now if I try to access some of them
comes a lot.
For example, first, not that one.
So I will have undefined value because actually we just declared it.
Now we can define them in the lines below or assign a value
in the lines below.
So what can do?
You can say first here, I don't have to put water in order to specify if it's variable.
I can say first I'm going to say Rick.
Sammy Gall here, and I'm just going to copy this one couple of more times, so first and the second
it will be Andy.
And third,
third will be John.
And fourth, Melissa.
So now if I get space, if I can, I can I mean, I can show them here.
If I do lock first, it will give me not any more undefined.
It will give me a ring.
Also, if you want to do so, I'm going to say, plus your karma and I'm going to see here, OK, second,
and that will give me first week and the second with commas in between.
So that is how we can just declare multiple variables in one line and after that in our code below,
we can just assign of values to them.
That's very good, right?
What else we can do here is we can mutate because the actual was very type coercion and notation.
Now this is and the first and first is and second is Andy.
But what if I change my mind and just want to put a second as a second place?
I just want to put it.
I don't know.
Novac.
So you should know who's Novak?
Is Novak Djokovic the famous tennis player?
Right.
So if I do it if I copy it right now, he and I should see Rick in Novak in a second place.
Right.
This is called variable mutation.
So we mutate its value.
Right.
Because here was and now the second place, it's Novak.
But because we are printing press here, that's why he's grabbing this value, the initial value from
Andy.
Now, we do have different value, and that is why we are seeing Novak here.
So how cool is this?
We can just changed our values as we won in our code as we need them.
Right.
So that is called a signing, declaring a variable, assigning a valuable in mediating.
This is called coersion.
When we put different types of variables with different values inside in one single go into one single
line.
So JavaScript is more and knows and that's not the case with other languages that, OK, I'm going to
put them, I'm going to just treat them all as a string's.
That's all you need to know right now.
And I hope you enjoyed this lecture.
And it's we're still working with variables, but it is what it is.
So we're learning a lot every day.
Something new, every lecture, something new.
I hope you like bleep subscribe.
Join me and help me out to grow anything that I do, grow my channels, grow my project, grow my courses,
because sharing means caring.
And I'm caring about you guys.
You care about me.
That is, I want to see a mutual respect and obligation and love here.
So thank you very much.
I hope to see you in the next one.
And I hope you enjoyed this one.