Hello and welcome to this video.
In this video I'll be explaining what arithmetic operators are and also showing you basic examples arithmetic.
Operators are operators that are used to perform arithmetic actions or functions on numbers or variables.
Here's a table of some basic arithmetic operators.
So start from the top where we've got the addition operator.
And basically that is used to add numbers of values together.
For example two plus two.
We've got the surprise action operator which is used to surprise pranked numbers of values.
Example for so practice to mix.
We've got the multiplication operator which is basically used to multiply numbers or values.
Example Seven times three in programming and a javascript multiplication is represented by the Asterix
symbol.
Next we have got the division which is used to divide numbers or values.
Example would divide four by eight.
Next we've got the modulus which is represented by the percent sign.
Modules operator is used to return the remainder from a division.
So we divide two numbers modules will return only what is left from the division.
Next we've got the increment operator which is represented by two plus symbols.
What that does.
It increases the value of a number or a variable for example if you've got a variable that has a value
of seven.
You want to increase our value to eight.
You use the called the variable name and then you add the plus plus symbol which is the incremental
operator.
And that will increase the value by 1.
The opposite of that is the decrement operator which is used to decrease the value of a number or a
variable by 1.
So these are the basic arithmetic operators in JavaScript.
You also find that these are identical to most programming languages as well.
So I'm going to go over to my console and basically show you some basic examples open up Google home
page on the Google home page to access the console if you are on a Windows computer you press control
shift and J if you're on a Mac you press command shift and J that will give you access to the console.
So I've got my console open and you should have this on the line next to the world console.
So let me just run through the basic arithmetic operator but first I want to illustrate if a basic addition
you may already know this already so do I apologize if I'm going through this again.
So I'm just going to illustrate by adding two numbers together.
I'm going to do two plus two and press enter and that will give you four next let me illustrate this
suppression.
I'm going to surprise two numbers.
So four from two press and turn my keyboard and that will return a value of two.
Next I want to multiply two numbers.
So I'll do a seven and an asterix Asterix is what you use to represent multiplication in JavaScript
and will multiply seven by three.
A press pointer that returns twenty one.
Next I'm going to illustrate a division example.
I'm going to divide two numbers so I'll divide eight by four.
And you represent division with the slash symbol press enter.
And that will return to next.
I want to illustrate the modulus operator models will only return the value of what is left after the
division.
So now to 5 and the percent to represent modulus.
So I expect this to return 1 because 2 can only go into I have twice and it should be remained the one
he can see is returned one.
Next I want to illustrate how the increment operator works.
First I'm going to declare a variable called X. I'm going to give it a value of seven.
So now if I call that value variable X it will return 7 say if I want to change the value from seven
to eight.
I can use the increment operator by just calling the variable by its name and doing plus plus twice.
And that will increase it.
If I now call the variable by his name it should now return a value of eight.
Next I want to illustrate how the discriminate operator works.
First I'm going to declare a variable called Y.
I'm gonna give it a value or five next.
If I call that variable it will return to 5.
So for example I want to decrease it to 4.
Just call the variable by its name and use the decrement operator which is two dashes.
Press enter.
Now if I call the variable why it will not show me a value of 4.
So that's basically how the decrement operator works so these are just very basic examples to illustrate
how the javascript arithmetic operators work.
Thanks for watching.
Bye for now.