Hello and welcome to our conclave to work.
We have to have some javascript in order to create some interaction.
So this is what our cockily told looks like at the moment at the moment if you click on any of the buttons
nothing happens.
It doesn't get displayed.
So what we are going to do here one thing to do.
I am going to they can click event into the buttons so that when the button clicks javascript will take
action and create some interaction.
An event is physically something that happens to his team element.
So when you use javascript inside hastier more web pages the javascript can react to the events.
An example of an event is when a button is clicked.
So when you click on a button that is known as an event you want javascript to do something.
When that event happens in order for that to happen we need to touch on Click event into the button.
So what that would do when you click on the button what ever value you placed inside that click event
it will respond to the button click.
So let's test that with one of the buttons and see if that works we'll just replicate the same process
to the rest of the button someone to start with.
Is there a button here.
So inside the button here I am going to show us expand this opening tank and touch on Click event so
you do that by typing in on a click.
See is upper case.
All right.
So that's the On Click event happening give it a value.
Can send two equals two.
So it's going to function in a way like an attribute.
So in between the quotes I'm going to have cash.
What will happen when someone clicks on the button so when someone clicks on the button I want the form
to be called the name of my form.
It's called Carl.
So when the button is click it's going to call this form which this card is then going to reference
the display which is this one here.
So I'm going to do dot display.
And also I wanted to display the value on the calculator button.
So I type in value and when I had an assignment operator.
This is known as an assignment.
Operate on plus equations.
What that does is an addition assignment operator.
It all had value to a variable.
So let me say that and let's test how that works then I'll just do the same for the other button so
I just refresh.
I click on this.
Okay.
Hasn't shown up which means something has not gone right.
K. I know what I've done wrong here now because I did not specify the value here for it to display this
assignment.
OPERATOR What is a plus minus.
Basically it as value to variable and I have not specify the value.
That's why it's not working so why need to do inside this equals 2 here.
I need to specify the value which is going to be zero so I enclosed out in single quotes.
Now if I see that and try again.
Hopefully that should work.
There you go.
You can see the LOSE there are there.
It's not that big but you can see it now which means it's working.
So what I'm going to do.
I'm just going to replicate the same thing to the other buttons by touching this one click event to
each of the button here.
So when someone clicks find a button it all trigger off it to display will reference the form and to
display it.
Which is a reference to this name.
Which is the name of the form and also the value on the button and then it all displayed have had tacked
on Click event.
The bottom line 27 multiplication is done using the asterisks symbol so you can see the asterisk symbol
here.
Multiplication is done on line 29 where we've got this C C basically is the clear button so we want
to clear the display to calculate.
You press the send button and I've set the value to you close to blank.
You can say this to single quotes here.
Meant blank so when you press the button the clear button which is the C it will clear the display to
this value which is Blank on line 30.
I've got the course too but I have not use addition.
Assignment operator in that is I've used it in the others but I have not used it in line for others
so it's online online 2019 that is on line 29.
There is no Edition assignment or protocols.
I don't want to store in advance I just want to clear this screen so when people click on this button
it clears the screen has not attached addition.
Assignment operator.
However on line 30 I am left out.
But instead I have used the java script function.
Notice here be about function.
The function basically is used to evaluate or execute argument inside a function.
You can see here for the round function here inside the parentheses.
I have added the comments and these are the arguments.
The calm which is the form here display which is this import display and then the value.
What value represents whatever value you press.
So all bottoms up different values.
For example if I punch two plus two That's what those values are free to say whatever value I compute
in here to evaluate that.
Inside this argument display that's what this function will do to evaluate.
Execute the argument inside this vital function.
To 1.
I just want to point out the deficient in Javascript is by the slash symbol.
Okay so even though I have represented the symbol differently the actual sign you need to do division
is the for this flash here.
So without doubt it or not to the division.
So in terms of functionality the javascript part of the skocpol Utah is physically done.
So if I say that then we can test that out and see if everything works.
All right so let's do a quick calculation here.
Let me open that up again.
So let me do for example list 2.
To.
Plus.
To you can see as I click on the button you can see it highlights the code and fire the course to sign
you can see the Who Wants to go see it.
It leads to four.
And the evaluation is done using this vital function.
That's what he computes the value that had.
And it gives me this.
This is the output in this this play area in the next video.
I'm going to make a calculator look pretty unpresentable than it is at the moment.
So that's what we're going to do in the next video.
Thank you for watching.
Bye for now.