Hi there.
Let's continue with our exercise would just stop that number five.
So now let's solve.
Number six.
Consider the following variable names and inform which are invalid and why.
I'm going to do this in the age damn male file.
So I have the answers written here.
So let me go back to the HDMI file.
Here it is.
Let me find this.
So here are the variable names.
I'm just going to write.
The ones that are invalid.
So the first one is name, we've all letters in caps.
No problem with this.
I don't like this style for naming variables, but this is valid.
Be.
Dollar sign num one.
This is also valid.
We can use dollar signs, we can use numbers, so no problem again.
Now let us see.
This one is invalid.
Because type of.
Is a reserved.
Word, letter, the first name.
This is also invalid because we have a dash.
We can use underscores, but we can not use dashes so invalid.
Because of.
Bashes.
Letter E attempt underscore to no problem with this one.
Letter F.
This one is invalid.
Because it starts with a number so we can use numbers, but we cannot start with a numbers.
So this is invalid and Ladder G.
This is also invalid.
Because of the empty.
Space.
So by saving this.
And going back there.
If we refresh the page, we can see that now our answers are here.
If you want to make this more visible, you can enclose this in a strong.
Tag like this.
I'm just going to do the same thing for the others.
Let me close this here.
Same thing for this one.
Now, if we save this and refresh the page.
All right, so now we can see our answers better.
So number seven, considered a block of code below.
And guess what?
Values will be shown in the console.
So, again, I'm just going to go to the agency CML and write my guesses and then we can execute the
code and see if this was right.
So let's go to the AGM and file.
We can find this inside this Bre-X element.
So, again, let's get the strong tag.
Let's put it here for our guests.
So now we have vast quantity, no pressure and temperature.
So in the first one, we have quantity and then we have the incremental operator.
So normally this was going to result in 50.
But actually, as you can see, this is a string.
So what happens when we use the incremental operator with strings?
We end up with a concatenation.
So what's actually going to happen here is just concatenating twenty five with twenty five.
OK, second one.
So seven plus five divided by number plus two.
So here we know that the first thing that's going to happen is what is inside the parentheses.
So seven plus five equals twelve.
Then we will have the division.
So twelve divided by six equals two and then two plus two.
My guess is that this is going to result in four.
Now we have the pressure, we just created it.
We did not assign anything.
So if we do sold log, this is going to result in.
Undefined, which is the lack of value of a variable.
Now the same thing for the temperature this time.
If we do this.
We are going to see the No.
Value for the temperature which we assigned to it.
And now the type of these variables.
So the first one we know that undefined is both a value and a type.
So the type is also going to be undefined.
And no is a value, but it's not a data type.
So if we try to get the type of this variable, we know that we're going to get an object in return.
Let's see if this is right.
I'm just going to save this before refreshing the page.
Let's just copy this code.
Go back there.
Go to the J.S. file.
So this is number seven.
So number seven, let's copy all this.
Now, refreshing the page.
We have all the results here.
Let's see if this is right.
So the first one I said.
Twenty five.
This is correct.
Then four.
Undefined, no undefined.
An object.
So everything's correct.
Now going to the last one.
Do the transformations to the you or else below.
So first, we need to include age DTP as to the string.
We can just do concatenation.
So let's get the ideas of the elements.
So the first one is you were out.
One.
Then we have you around, too.
You are out three and you are out for.
So number eight.
You can just create one variable for each of the results.
So the first result is going to be you are out one.
So here we are going to use document that get element by I.D. and the I.D. is your real one.
So what we need to do here is adding the H.
D to P.
S.
So this is pretty simple to do.
We can just add it right here.
So H CTP s plus the content of that first element.
Now.
We just forgot the inner ASTM, Al.
Now, this is better.
So now let's get this.
And do documents get element by I.D. your are to that inner ASTM al equals, then we can just paste
the you are al that we formed by concatenating the H tdb s..
All right.
Before moving on, let's see if this one is right.
So refreshing.
The page going down there.
We can see that this is working.
So now we need to do the opposite with this one.
We need to remove the HTP.
S.
So I'm just going to copy both lines.
So now you are out to.
It's going to be.
That element which has the idea of you around three, if you want, you can just go back here and check
it by yourself.
As you can see, this is you are out three.
And the next one is you around four.
So here we have the full Google you around.
And now we can just do your L two equals.
You are out two dots replace.
You can do like this.
Or if you don't want to repeat this, what you can do is just include parentheses here.
I like to do this to organize, so now I know that inside here I'm going to have the exact value.
That's inside that element.
And then we can just do a replace method.
And then we are going to replace the Age CTP as.
Colin Ford slashed Ford's slash.
We are going to replace it with an empty string.
So now we get the you are out for.
And send the content of this string that we just formed.
Let's see if this is right.
So now we can see that we successfully removed the HTP ask from the you are out.
So that was it.
I hope you like this exercise and that you were able to do it without any problem.
So in the next we do, we are going to start diving deeper into JavaScript.
I'll see you then.