1 00:00:00,630 --> 00:00:02,140 Hello and welcome. 2 00:00:02,240 --> 00:00:13,050 In this fit you are introducing you to the javascript comparison operators javascript comparison operators 3 00:00:13,110 --> 00:00:18,090 are used to compare values and will return. 4 00:00:18,480 --> 00:00:23,550 The end result burning embers claiming is true or false. 5 00:00:23,640 --> 00:00:34,100 So we use jammer scroop comparison operators tool always return the true value or force value. 6 00:00:34,770 --> 00:00:45,450 So this is a basic table illustrating some comparison operators so our start from the top with the first 7 00:00:45,540 --> 00:00:53,340 is known as the equal OPERATOR And is represented with the double equal symbol. 8 00:00:53,430 --> 00:00:56,040 So what that does is checks. 9 00:00:56,160 --> 00:01:05,330 If values are equal How case if you want to compare two values A You use the equal to operator. 10 00:01:05,520 --> 00:01:12,310 If you want to check if values are equal both in value and data type. 11 00:01:12,470 --> 00:01:21,900 Is this strictly equal to what is represented with the triple equal sign is single equal is used to 12 00:01:21,990 --> 00:01:23,640 assign value. 13 00:01:23,880 --> 00:01:32,190 So we must be careful between the distinction between single equals or double few on a check if something 14 00:01:32,190 --> 00:01:33,660 is equal to something. 15 00:01:33,660 --> 00:01:35,110 Here is a double sequence. 16 00:01:35,130 --> 00:01:43,410 If you want to assign in value like you do in variables he use just a single equal to 1 pay. 17 00:01:43,440 --> 00:01:51,850 The values are strictly equal in but data type and value who use to triple equal symbol. 18 00:01:51,890 --> 00:02:01,470 If you want to check if values are not equal you use the exclamation mark in the course to sign that 19 00:02:01,730 --> 00:02:02,490 check. 20 00:02:02,610 --> 00:02:12,820 If the value is not equal if you want to check if the values are strictly not equal in value and data 21 00:02:12,960 --> 00:02:17,810 you use the exclamation and double or symbol. 22 00:02:18,060 --> 00:02:25,110 So if you want to check if a value is greater than another value you use the greater than sign. 23 00:02:25,140 --> 00:02:29,480 For example you want to check if 5 is greater than 2. 24 00:02:29,640 --> 00:02:37,070 If you want to check if it values lets let's use the less than symbol with checks n number less than 25 00:02:37,070 --> 00:02:39,440 another number of value. 26 00:02:39,570 --> 00:02:46,500 You can also use the greater than or equal to which is represented by the greater than sign. 27 00:02:46,500 --> 00:02:49,980 If I was to cite what that does it. 28 00:02:50,050 --> 00:02:51,060 Checks. 29 00:02:51,300 --> 00:03:01,400 If the values is greater than or equal to the less than or equal to 3 percent by the less than symbol 30 00:03:01,440 --> 00:03:04,780 and the cost to sign this checks. 31 00:03:04,800 --> 00:03:08,800 If the value is less than or equal to. 32 00:03:09,240 --> 00:03:17,670 So I'm going to jump into the console now and give you some basic examples of these comparison operators. 33 00:03:17,670 --> 00:03:20,220 So we are using comparison operators. 34 00:03:20,220 --> 00:03:21,700 There will always return. 35 00:03:21,740 --> 00:03:24,540 That is true of force result. 36 00:03:24,720 --> 00:03:35,990 So for example if I want to check if 4 is equal as to 5 that will return force equals four is not equal 37 00:03:35,990 --> 00:03:37,270 to fact. 38 00:03:37,500 --> 00:03:49,290 If I want to check if a value is strictly was in type and also in value so what I do first I create 39 00:03:49,380 --> 00:03:52,790 a variable qualifiable cortex. 40 00:03:52,890 --> 00:04:00,620 Give this a value of 7 quit a variable called Y. 41 00:04:01,140 --> 00:04:09,030 Now give this value of 7 but the 7 will be a string value. 42 00:04:09,360 --> 00:04:14,180 So we move the data type is different from variable X.. 43 00:04:14,340 --> 00:04:16,990 So now I can do a comparison. 44 00:04:17,010 --> 00:04:27,500 I can see X is a course to why this will return to true because both of them have value of 7. 45 00:04:27,510 --> 00:04:34,560 Now if I choose to triple course to it return full force because the data type is different then fairly 46 00:04:34,560 --> 00:04:35,180 is the same. 47 00:04:35,180 --> 00:04:45,930 So if I do X Troop or cause to Y that will give me results of force because they are not equal in data 48 00:04:45,930 --> 00:04:50,280 type variable y has a data type of string. 49 00:04:50,840 --> 00:04:58,200 You can tell because of the quotes that is enclose around the value and variable x is numerical which 50 00:04:58,200 --> 00:04:59,940 has a value of 7. 51 00:05:00,250 --> 00:05:03,430 They're the same in value but not the same. 52 00:05:03,450 --> 00:05:05,100 In that attack. 53 00:05:05,220 --> 00:05:07,560 So if you want to check two values are the same. 54 00:05:07,560 --> 00:05:23,160 For example if I see it is not equal to 7 that will return true because it is bigger than 7 so it is 55 00:05:23,160 --> 00:05:24,900 not equal to 7. 56 00:05:25,020 --> 00:05:29,600 So if I want to check if the number is greater than another number one take. 57 00:05:29,600 --> 00:05:38,170 If the 9 is greater than c hate that will evaluate to be true because 9 is greater than 8. 58 00:05:38,520 --> 00:05:46,500 If we say 8 we call 8 is less than. 59 00:05:47,550 --> 00:05:49,640 Say seven. 60 00:05:49,780 --> 00:05:55,780 We have Valerie to be true because eight is greater than seven. 61 00:05:55,790 --> 00:06:03,650 So here I am using the leston Sign compering if it is less than seven that has written force because 62 00:06:03,740 --> 00:06:07,100 it is greater than seven. 63 00:06:07,100 --> 00:06:18,560 If I was to see seven is less than eight that will evaluate to be true because seven is less template. 64 00:06:18,710 --> 00:06:20,950 So let me quote a couple of variables. 65 00:06:20,980 --> 00:06:28,190 A great variable we give you the value of 17. 66 00:06:28,290 --> 00:06:30,500 Can I use the comparison. 67 00:06:30,530 --> 00:06:46,420 So if I see a he is greater than or equal to 17 that will evaluate to be true because a variable A is 68 00:06:46,560 --> 00:06:50,140 term seeing is greater than or equal to 17. 69 00:06:50,150 --> 00:06:58,460 So that if that is to be true in fact create another variable see a quick variable B and I'm saying 70 00:06:58,460 --> 00:07:00,430 it in value of 10. 71 00:07:00,930 --> 00:07:12,890 And I want to check comparison so if I see is variable be less than or equal to 9 that evaluate to be 72 00:07:12,890 --> 00:07:17,130 false because B is 10. 73 00:07:17,210 --> 00:07:23,120 So these are basic examples of comparison operators. 74 00:07:23,120 --> 00:07:31,250 Once you understand the basic concepts then it would be easy for you to use the compression operator. 75 00:07:31,490 --> 00:07:32,910 That's it for this video. 76 00:07:32,930 --> 00:07:34,250 Thank you for watching. 77 00:07:34,310 --> 00:07:35,010 By phone.