1 00:00:00,540 --> 00:00:03,430 Hello and welcome to this video. 2 00:00:03,480 --> 00:00:14,460 In this video I'll be explaining what arithmetic operators are and also showing you basic examples arithmetic. 3 00:00:14,460 --> 00:00:26,230 Operators are operators that are used to perform arithmetic actions or functions on numbers or variables. 4 00:00:26,520 --> 00:00:32,240 Here's a table of some basic arithmetic operators. 5 00:00:32,280 --> 00:00:37,150 So start from the top where we've got the addition operator. 6 00:00:38,000 --> 00:00:43,860 And basically that is used to add numbers of values together. 7 00:00:43,860 --> 00:00:46,370 For example two plus two. 8 00:00:46,770 --> 00:00:53,810 We've got the surprise action operator which is used to surprise pranked numbers of values. 9 00:00:53,820 --> 00:00:58,410 Example for so practice to mix. 10 00:00:58,410 --> 00:01:06,830 We've got the multiplication operator which is basically used to multiply numbers or values. 11 00:01:06,870 --> 00:01:16,920 Example Seven times three in programming and a javascript multiplication is represented by the Asterix 12 00:01:17,100 --> 00:01:18,290 symbol. 13 00:01:18,360 --> 00:01:24,730 Next we have got the division which is used to divide numbers or values. 14 00:01:24,750 --> 00:01:29,200 Example would divide four by eight. 15 00:01:29,380 --> 00:01:35,790 Next we've got the modulus which is represented by the percent sign. 16 00:01:36,000 --> 00:01:42,510 Modules operator is used to return the remainder from a division. 17 00:01:42,510 --> 00:01:49,420 So we divide two numbers modules will return only what is left from the division. 18 00:01:49,620 --> 00:01:57,240 Next we've got the increment operator which is represented by two plus symbols. 19 00:01:57,300 --> 00:01:58,270 What that does. 20 00:01:58,290 --> 00:02:06,600 It increases the value of a number or a variable for example if you've got a variable that has a value 21 00:02:06,600 --> 00:02:07,750 of seven. 22 00:02:07,890 --> 00:02:10,130 You want to increase our value to eight. 23 00:02:10,350 --> 00:02:17,130 You use the called the variable name and then you add the plus plus symbol which is the incremental 24 00:02:17,130 --> 00:02:17,910 operator. 25 00:02:18,120 --> 00:02:20,770 And that will increase the value by 1. 26 00:02:20,790 --> 00:02:28,680 The opposite of that is the decrement operator which is used to decrease the value of a number or a 27 00:02:28,680 --> 00:02:30,660 variable by 1. 28 00:02:30,930 --> 00:02:36,970 So these are the basic arithmetic operators in JavaScript. 29 00:02:37,080 --> 00:02:43,070 You also find that these are identical to most programming languages as well. 30 00:02:43,140 --> 00:02:52,440 So I'm going to go over to my console and basically show you some basic examples open up Google home 31 00:02:52,440 --> 00:03:01,680 page on the Google home page to access the console if you are on a Windows computer you press control 32 00:03:02,100 --> 00:03:11,630 shift and J if you're on a Mac you press command shift and J that will give you access to the console. 33 00:03:11,790 --> 00:03:19,200 So I've got my console open and you should have this on the line next to the world console. 34 00:03:19,200 --> 00:03:26,760 So let me just run through the basic arithmetic operator but first I want to illustrate if a basic addition 35 00:03:27,210 --> 00:03:32,950 you may already know this already so do I apologize if I'm going through this again. 36 00:03:33,030 --> 00:03:37,190 So I'm just going to illustrate by adding two numbers together. 37 00:03:37,200 --> 00:03:46,450 I'm going to do two plus two and press enter and that will give you four next let me illustrate this 38 00:03:46,450 --> 00:03:47,880 suppression. 39 00:03:47,880 --> 00:03:49,740 I'm going to surprise two numbers. 40 00:03:49,800 --> 00:03:59,180 So four from two press and turn my keyboard and that will return a value of two. 41 00:03:59,220 --> 00:04:02,880 Next I want to multiply two numbers. 42 00:04:02,880 --> 00:04:11,910 So I'll do a seven and an asterix Asterix is what you use to represent multiplication in JavaScript 43 00:04:12,600 --> 00:04:16,100 and will multiply seven by three. 44 00:04:16,180 --> 00:04:20,300 A press pointer that returns twenty one. 45 00:04:20,330 --> 00:04:23,900 Next I'm going to illustrate a division example. 46 00:04:24,130 --> 00:04:29,520 I'm going to divide two numbers so I'll divide eight by four. 47 00:04:30,320 --> 00:04:35,470 And you represent division with the slash symbol press enter. 48 00:04:36,030 --> 00:04:38,960 And that will return to next. 49 00:04:38,970 --> 00:04:47,520 I want to illustrate the modulus operator models will only return the value of what is left after the 50 00:04:47,530 --> 00:04:48,120 division. 51 00:04:48,630 --> 00:04:55,200 So now to 5 and the percent to represent modulus. 52 00:04:55,200 --> 00:05:02,850 So I expect this to return 1 because 2 can only go into I have twice and it should be remained the one 53 00:05:02,960 --> 00:05:05,410 he can see is returned one. 54 00:05:05,430 --> 00:05:09,930 Next I want to illustrate how the increment operator works. 55 00:05:09,930 --> 00:05:18,810 First I'm going to declare a variable called X. I'm going to give it a value of seven. 56 00:05:19,080 --> 00:05:28,770 So now if I call that value variable X it will return 7 say if I want to change the value from seven 57 00:05:28,860 --> 00:05:29,850 to eight. 58 00:05:29,910 --> 00:05:39,510 I can use the increment operator by just calling the variable by its name and doing plus plus twice. 59 00:05:39,990 --> 00:05:41,140 And that will increase it. 60 00:05:41,160 --> 00:05:46,710 If I now call the variable by his name it should now return a value of eight. 61 00:05:46,740 --> 00:05:52,200 Next I want to illustrate how the discriminate operator works. 62 00:05:52,230 --> 00:05:56,090 First I'm going to declare a variable called Y. 63 00:05:56,940 --> 00:06:03,050 I'm gonna give it a value or five next. 64 00:06:03,150 --> 00:06:07,760 If I call that variable it will return to 5. 65 00:06:07,800 --> 00:06:11,470 So for example I want to decrease it to 4. 66 00:06:11,580 --> 00:06:21,570 Just call the variable by its name and use the decrement operator which is two dashes. 67 00:06:21,600 --> 00:06:22,480 Press enter. 68 00:06:22,530 --> 00:06:26,880 Now if I call the variable why it will not show me a value of 4. 69 00:06:27,390 --> 00:06:34,770 So that's basically how the decrement operator works so these are just very basic examples to illustrate 70 00:06:35,040 --> 00:06:40,080 how the javascript arithmetic operators work. 71 00:06:40,080 --> 00:06:41,220 Thanks for watching. 72 00:06:41,220 --> 00:06:41,880 Bye for now.