00:00:01 – you may have noticed before that I use

00:00:04 – the + operator for like adding for when

00:00:07 – we assign two variables multiple values

00:00:09 – to the + operator if you remember that

00:00:10 – well in this section will be actually

00:00:13 – mentioning some of the actually all the

00:00:16 – kinds of operators we have in JavaScript

00:00:18 – an operator's allow operations to occur

00:00:21 – so operations are raised with any sort

00:00:23 – of mathematical any sort of like any

00:00:27 – sort of work done with data values so

00:00:31 – basically we'll be dealing with numbers

00:00:33 – in this in this in this tutorial so

00:00:36 – working with all the operations we have

00:00:37 – excuse me we have what numbers we have

00:00:41 – five types of i divided them into five

00:00:44 – subgroups of operators we have

00:00:46 – arithmetic we have assignment we have

00:00:49 – bitwise comparison and logical and we're

00:00:52 – going to have a look at all of them so

00:00:53 – the first one we have is arithmetic it

00:00:55 – has the fault we use the following

00:00:56 – symbols for those you falling operator

00:00:59 – so we have plus minus multiplication

00:01:03 – division and yet the basic and modulo

00:01:08 – where there's modulo module here we go

00:01:11 – and there we go so that's those are our

00:01:14 – basic mathematical operators we also

00:01:17 – have exponential which actually doesn't

00:01:20 – work I'll talk about that in a bit so

00:01:22 – let's just go each one one by one so far

00:01:25 – a we're going to call have some

00:01:26 – variables now our B equals seven

00:01:29 – d'ivoire c equals so this is addition

00:01:32 – just simply eight adding two numbers

00:01:35 – together console see pretty simple stuff

00:01:41 – with math pretty straightforward

00:01:42 – mathematical stuff so 12 subtraction you

00:01:47 – just do minus denoted with the dash

00:01:50 – operators are denoted with this pink

00:01:52 – like this this is also an operator the

00:01:55 – assignment operator is like one of the

00:01:58 – main assignment operator so it means the

00:01:59 – left side is going to be set equal to

00:02:01 – the right side and minus is a binary

00:02:05 – operator which means it takes two

00:02:07 – operands so because a and B left and

00:02:10 – right operand left right if you those

00:02:13 – are called binary

00:02:15 – binary on sand to we won't actually say

00:02:18 – that southern binary will confuse it

00:02:19 – with bitwise which was in binary numbers

00:02:21 – anyway sorry about that what I'm saying

00:02:23 – is the left and side and right side are

00:02:26 – called operands this is an operand and

00:02:28 – this is an operand and that's the

00:02:29 – operator alright so that was subtraction

00:02:32 – multiplication multiplying them 35 5

00:02:36 – times 7 35 division it'll is so like in

00:02:41 – JavaScript like I said numbers are one

00:02:42 – type so it will turn the exact value

00:02:44 – significant to like 10 I don't know how

00:02:48 – many dishes here 13 digits i think i

00:02:50 – will see that in a later chapter and on

00:02:53 – time to count them right now on ok so

00:02:55 – let's see and then we have modulo you're

00:02:58 – not familiar with modulo that is

00:02:59 – basically divide the numbers together

00:03:02 – and you get the remainder so when you

00:03:04 – divide it you get 5 so 5 divided by 7

00:03:07 – results in some sort of value get 5

00:03:10 – afterwards now if that if that result

00:03:14 – was kind of weird-looking let me do

00:03:16 – something simpler that we use modulo 4

00:03:18 – so i use module oftentimes when we want

00:03:21 – one I want to get check and even odd

00:03:23 – numbers so here's 44 even number when

00:03:26 – you divide it by 2 you're checking so

00:03:28 – when you modulo 2 gets remainder 40 so

00:03:32 – you get 44 / to get better remainder

00:03:35 – which is 0 because it's a clean division

00:03:37 – that means it's an even number so when

00:03:40 – this results when a modulo of the left

00:03:43 – love modular right equals 0 that means

00:03:46 – the left side is an even number so a is

00:03:50 – an even number which is 44 that's an

00:03:52 – even number so 43 if we do that there

00:03:55 – that means we get one because if there's

00:03:57 – a remainder 1 that means it's an odd

00:03:59 – number when you modulo 2 so 4 T 3 modulo

00:04:02 – 2 is one which means 43 is an odd number

00:04:05 – you can also use when checking if an

00:04:07 – unknown value being any budget is an odd

00:04:09 – number or you a number which will see

00:04:11 – you when we talk more about conditional

00:04:13 – statements but anyway let's move on so

00:04:17 – the last arithmetic operator is this

00:04:19 – star star in this current um there's

00:04:23 – select sort of versions and types of

00:04:26 – JavaScript out there on the internet

00:04:28 – in certain browsers they certain types

00:04:30 – of script syntax or JavaScript are used

00:04:33 – in mine this operator doesn't work I

00:04:38 – tested it before this video in like

00:04:40 – sorry three schools it will talk about

00:04:43 – it for example and say it works on

00:04:45 – sitting a lot of cases by some cases it

00:04:47 – doesn't all my case it doesn't so I

00:04:49 – can't really demonstrate here but this

00:04:51 – will basically example throat up here 25

00:04:54 – this should return 32 and some browsers

00:04:57 – and some interpreters of JavaScript but

00:05:01 – some in my case it doesn't work anyway

00:05:03 – moving on let's get to the some other

00:05:07 – over the choppers we have we have a

00:05:09 – couple more actually they're incremental

00:05:11 – operators you have plus plus and minus

00:05:13 – minus so what these are they allow you

00:05:17 – to increment and decrement operators

00:05:19 – these are often used in when you're

00:05:22 – working with iterations such as in loops

00:05:23 – so let's take a look at the following so

00:05:28 – we're going to need one variable for

00:05:29 – this let's return out the 434 so we have

00:05:33 – plus plus what this does you see it

00:05:38 – didn't it's supposed to increment the

00:05:40 – value by a 1 plus plus so that's a plus

00:05:43 – plus does well if as you can see here it

00:05:47 – didn't do for you didn't just play 45 as

00:05:51 – it should but this one will display 45

00:05:54 – what this is is this is prefix meaning

00:05:59 – that it'll increase the value first and

00:06:01 – then work with it and somewhat in some

00:06:03 – way if you do after it'll return the

00:06:06 – current event the original value and

00:06:08 – then increase it or the current value

00:06:10 – and then increase it afterwards so let

00:06:12 – me do this this is a kind of thing and

00:06:17 – programming it should be understood see

00:06:21 – we'll see what happened here i increased

00:06:23 – it twice basically so i should actually

00:06:25 – remove that so like i said ok give me a

00:06:29 – the first time 44 increase it and then

00:06:33 – said give me whatever value eight is

00:06:35 – increased immediately that's what this

00:06:36 – brief this is called prefix and this is

00:06:39 – called post fix

00:06:41 – so let me remove this C and the next

00:06:45 – time you get 45 that's because we we

00:06:48 – took it increased it afterwards after

00:06:51 – getting it taking it and working with it

00:06:53 – then its values 45 the same thing goes

00:06:56 – for minus so we said a can be 44 then

00:07:00 – subtract it and then return the value

00:07:03 – again some 43 and then prefix so

00:07:07 – probably a postfix and prefix so 4343

00:07:13 – yeah so that's prefix and postfix of

00:07:16 – these increment operators are also

00:07:18 – considered arithmetic because you're

00:07:19 – essentially adding one to them so it's

00:07:22 – like saying a plus equals one and that

00:07:25 – leads us to our next set of operators

00:07:27 – which are assignment operators they're

00:07:29 – pretty simple it's just basically these

00:07:32 – arithmetic operators and adding equal

00:07:35 – sign so this was the additional addition

00:07:39 – assignment which is basically saying a

00:07:41 – equals 44 then a plus 1 and then saying

00:07:47 – give me back a this is also Plus Ones

00:07:53 – also equivalent to equal sign so notice

00:07:57 – here it didn't do anything because that

00:08:01 – only works on that line itself but if we

00:08:04 – wanted actually so what we did here this

00:08:06 – is some sort of floating global value

00:08:08 – global values will talk about scope so

00:08:11 – we're saying here a +1 at this line is

00:08:14 – going to be 40 44 45 and then you notice

00:08:19 – here it's not stored to anything that's

00:08:21 – because we didn't assign this operation

00:08:24 – to the value so we have to assign an ad

00:08:27 – so we're adding so we're saying okay

00:08:30 – aids new value is going to be a plus 1

00:08:33 – this is equivalent to this actually a

00:08:35 – plus 1 45 instead of duplicating the

00:08:40 – writing of a you just do that so that's

00:08:44 – assignment operator and you do the same

00:08:46 – thing with all the others so minus 1 for

00:08:49 – example you can actually change the

00:08:52 – number up the same

00:08:53 – is two freshmen to that right and save

00:08:58 – it okay to you can do / 2 22 you can

00:09:05 – multiply by 2 multiplied in sign so

00:09:10 – basically so you don't have to say plus

00:09:12 – then equal a equals april's to for

00:09:15 – example because if you just do a plus 2

00:09:17 – by itself it won't save and you can also

00:09:20 – do mÃ³dulo as well and you get 0 so

00:09:24 – basically you're saying okay give me a

00:09:25 – then sign it assign the value we're

00:09:29 – equal to this operator done with this

00:09:31 – number all right if that sounds if

00:09:34 – that's okay alright so moving on if you

00:09:37 – for following this list now we have now

00:09:41 – bitwise operators so bitwise operators

00:09:45 – basically work with allow us to work

00:09:47 – with binary values values for now

00:09:49 – familiar binary numbers you might not

00:09:52 – get these so i recommend you before

00:09:54 – diving into this you might want to

00:09:56 – revert refreshing binary numbers level

00:09:59 – but i will try my best to show you what

00:10:01 – everything is doing so let's say we have

00:10:03 – a bar called bin one big one we're going

00:10:07 – to say seven and to actually let me let

00:10:14 – me actually write out the binary

00:10:16 – operators to bitwise operators so we

00:10:17 – have and we have or we have inverse

00:10:24 – where's inverse of squiggly for what

00:10:27 – it's called we have left shift we have

00:10:29 – right shift and I believe I believe

00:10:34 – that's it yes and we have we're supposed

00:10:36 – to have nope that is I believe that is

00:10:42 – it no we also have one more which I

00:10:45 – forgot is I think X or it looks like

00:10:48 – that will explain all of don't worry so

00:10:51 – here we have seven and two so notice

00:10:57 – here how I didn't write binary numbers

00:10:59 – that's because in JavaScript when you

00:11:02 – see right the operator this one the left

00:11:04 – and right sides of it will be

00:11:05 – automatically

00:11:06 – considered a binary so these numbers

00:11:10 – would like this in binaries just so you

00:11:12 – don't have to reference anything so this

00:11:15 – should be like 0 1 1 1 and 0 0 1 0 which

00:11:21 – equals 0 0 1 0 when you have been one

00:11:28 – you'll see that the result is to which

00:11:32 – goes in binary so this would be 1 1 is 2

00:11:35 – this is 2 yep checks out let's do or now

00:11:38 – or of these two loops or oh these two so

00:11:42 – it look like this poor would be the

00:11:45 – following it would actually be 0 1 1 1

00:11:49 – that number is 7 so we or operator which

00:11:54 – checks basically if if you see a 1

00:11:58 – combination of 10 or 11 you will get one

00:12:03 – as a result and by the way I should have

00:12:06 – explained and means if you only have the

00:12:09 – result 11 comparing to each bit that

00:12:13 – means they get a 1 so that's why it is

00:12:15 – only with this one of those one so

00:12:18 – that's and and now we have I should say

00:12:21 – X or first X or that means we'll have a

00:12:26 – case where only their want different

00:12:29 – values so only when we have zero one

00:12:34 – soul of comparing the first 10

00:12:37 – Carnesecca 11 comparing the third 10

00:12:40 – wearing the second one and you'll see

00:12:44 – the result oops I didn't change that X

00:12:50 – sores will shift six that's five that

00:12:53 – checks out yep that's five and next we

00:12:57 – have inverse so inverse is basically

00:13:02 – inverts the bits let's do that with one

00:13:06 – number actually there we go so that's

00:13:11 – basically not if you're familiar not in

00:13:16 – binary just basically shift so

00:13:19 – you say not 0 1 0 1 equals 1000 this is

00:13:24 – unsigned by the way so you actually know

00:13:27 – it is signed a while it is signed so um

00:13:29 – you get minus 8 from that so that's not

00:13:33 – you can actually even do this with

00:13:35 – multiple inverses so let's say and kind

00:13:39 – of like that and five so you can even do

00:13:44 – this that's basically and you'll get the

00:13:48 – following so you can basically make some

00:13:51 – match operators the same thing goes for

00:13:53 – an arithmetic which we'll get into a

00:13:55 – great deal detailed more examples as we

00:13:57 – progress through these this course

00:13:59 – alright so that's bitwise operators wait

00:14:03 – there's a couple more there's oh there's

00:14:04 – left shift and there's right shift so

00:14:07 – these two right here left shift right

00:14:09 – shift so let's say we have the number 20

00:14:13 – and we're going to say left this one too

00:14:17 – so what this says is anyone's are

00:14:20 – shifted off the number are removed

00:14:23 – actually wait no left shift what it does

00:14:26 – it shifts bits in the number of whatever

00:14:29 – place is defined here so we're saying

00:14:32 – shift the bits same here let's so you

00:14:37 – have 0 1 0 1 0 0 that's that is 20

00:14:43 – shifted to the left to buy two bits

00:14:46 – basically translates to 10 100 and any

00:14:52 – bits that are shifted off the edge here

00:14:56 – are deleted for good so let's do that

00:14:59 – you get 80 so this will check out to be

00:15:03 – 80 let me see ya so when you shift the

00:15:09 – binary result of 20 by two to the left

00:15:12 – so increasing the number you'll get 80

00:15:14 – and if you do it to the right so let's

00:15:18 – do that by one instead and you'll get 40

00:15:21 – so let's do it by left by one I mean

00:15:26 – right by one give the bits to the right

00:15:28 – now so going that way pointing to the

00:15:31 – where this goes you should

00:15:32 – j'adore right by one and that's going to

00:15:35 – be basically so shift to the right by

00:15:39 – one to Morgan to see more visual equals

00:15:41 – 0 0 1 0 0 1 0 and that's going to be 10

00:15:48 – yep so you got to and you got weights 0

00:15:54 – 0 1 0 1 2 2.1 248 actually this should

00:16:03 – be shifted to hear there you go that's

00:16:05 – 10 that's correct alright so moving on

00:16:09 – we have comparison operators now besides

00:16:12 – maybe a little boring you but I'll try

00:16:13 – to pick up the pace a little so

00:16:15 – comparison operators are basically they

00:16:17 – return boolean values so return true or

00:16:20 – false based on what we have so basically

00:16:22 – they're like in comparison mathematics

00:16:25 – so you have left greater than less than

00:16:27 – you have equal signs equal sign and

00:16:30 – comparisons is always 2 equals because

00:16:32 – the signal equals is the assignment

00:16:34 – operator yourself left set greater than

00:16:36 – or less than greater than or equal to or

00:16:39 – less than or equal to and you know and

00:16:42 – you have a course the last 13 which I

00:16:44 – mentioned one last tutorial this

00:16:46 – basically checks for the type the equal

00:16:49 – value and the type which will see right

00:16:51 – now so let's say we have far i equals 77

00:16:56 – to the car B equals actually equals 66

00:17:03 – just a console right say a so equals B

00:17:07 – that's going to be false we're going to

00:17:09 – say is less than B also false 77th

00:17:14 – greater than 60 60 k is greater than B

00:17:16 – true and we're going to say now less

00:17:22 – than or equal to greater than equal to

00:17:25 – sorry and then we say less than or equal

00:17:27 – to which is false see all these

00:17:29 – operators return false and now let's do

00:17:31 – equals equals so okay that's fault

00:17:35 – obviously but let's do so let's say B is

00:17:39 – actually 77 in a string if we City equal

00:17:42 – with a point to that's true because when

00:17:46 – convert this to a number they're

00:17:48 – essentially they represent the same

00:17:50 – value the data so Java scripts like oh

00:17:52 – yeah that's easy they're both 77 duh but

00:17:56 – what if we don't want that we want to

00:17:57 – check if the input strictly number 77

00:18:00 – and not the strings already said well

00:18:02 – you use the 33 equal signs of the triple

00:18:05 – equal sign operator I forgot to call

00:18:08 – it's like the checks the type the type

00:18:10 – the type and value so this is all the

00:18:15 – news when you're checking input and you

00:18:16 – want to make sure something's a string

00:18:18 – or integer for example or you're

00:18:21 – verifying input and you'll see you'll

00:18:23 – see this a lot more when we compare

00:18:24 – operators alright moving on let's

00:18:29 – finally do the next I think that's all

00:18:32 – of the code you also have not this

00:18:41 – basically converts the boolean result of

00:18:43 – this so like not and we have not I think

00:18:49 – that's the next one oh yeah that's the

00:18:51 – next one actually so we hope this helped

00:18:54 – and we hope to see you next time

Video Url:

http://youtu.be/sYpeS1SUKKw