1
00:00:00,570 --> 00:00:01,770
Hello and welcome.

2
00:00:01,800 --> 00:00:12,120
In this video I'll be introducing you to the javascript logical operators for JavaScript logical operators

3
00:00:12,470 --> 00:00:20,310
who are used to determine the logic between variables or values.

4
00:00:20,310 --> 00:00:26,220
So this is a basic table that shows you two logical operators.

5
00:00:26,220 --> 00:00:33,960
The first is called and and is represented by the ampersand symbol.

6
00:00:33,960 --> 00:00:35,130
What that does.

7
00:00:35,130 --> 00:00:39,130
It checks if all the conditions are met.

8
00:00:39,390 --> 00:00:45,330
And it will return a boolean result either true or false.

9
00:00:45,330 --> 00:00:49,650
If all the conditions are met it will return true.

10
00:00:49,650 --> 00:00:52,230
If not it returns false.

11
00:00:52,350 --> 00:00:58,790
The links is the or operator which is represented by the pipe symbol.

12
00:00:58,800 --> 00:01:07,240
It checks if any condition has been met and it will return a true boolean result.

13
00:01:07,260 --> 00:01:12,210
So the key distinction between the end and the all is that when you're using the.

14
00:01:12,230 --> 00:01:18,080
And to check conditions or the conditions has to evaluate to true.

15
00:01:18,270 --> 00:01:25,320
If they're not met then it will return a false boolean result boolean resolved basically means true

16
00:01:25,320 --> 00:01:35,520
or false in the all operator you only have to satisfy one condition it will return true result.

17
00:01:35,520 --> 00:01:43,080
So let me quickly illustrate how the logical operators are used in the console.

18
00:01:43,080 --> 00:01:49,480
So I'm going to start by creating a couple of variables are quite variable x.

19
00:01:49,590 --> 00:02:01,770
I give you the value of seven are great on another variable and I'm going to call this variable Y and

20
00:02:02,000 --> 00:02:05,730
I'll give it a value of six.

21
00:02:05,730 --> 00:02:18,310
Now I can use the logical operators to check the condition so I can say X is less than 10.

22
00:02:18,450 --> 00:02:29,100
If x is less than 10 and Y is greater than 6.

23
00:02:29,280 --> 00:02:41,850
This will evaluate to be false because the first condition is true X is less than 10 but second condition

24
00:02:41,850 --> 00:02:47,790
is forced because Y is not greater than six so it will evaluate to be false.

25
00:02:48,390 --> 00:02:57,480
So if I use the all operator with the same condition it will return true because one part of the condition

26
00:02:57,960 --> 00:02:58,460
is true.

27
00:02:58,860 --> 00:03:01,110
So it will return everything as true.

28
00:03:01,110 --> 00:03:08,070
For example the same illustration if I come in and say X is less than 10

29
00:03:10,760 --> 00:03:16,500
or Y is greater than six.

30
00:03:16,560 --> 00:03:24,640
This will evaluate to be true because the first part of the condition is true X is less than 10.

31
00:03:24,780 --> 00:03:31,260
So that's basically how you use a logical operator.

32
00:03:31,380 --> 00:03:40,440
In a nutshell once you understand this basic use of it then it will be able to it'll make most sense

33
00:03:40,830 --> 00:03:43,380
when you start using it later.

34
00:03:43,380 --> 00:03:45,360
Thank you for watching and bye for now.
