From the course: JavaScript Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Logical operators - JavaScript Tutorial
From the course: JavaScript Essential Training
Logical operators
- [Instructor] Conditional statements like this if, else statements rely on logical operators. We briefly talked about these earlier and now we can see them in action. A conditional statement is looking for a condition to either be met or not met, meaning we can use any expression that returns either true or false as the condition. In this example, I'm using the backpack age method which returns the number of days since the backpack was originally acquired and then I'm asking if the everyday backpack age is larger than or equal to 30, then we return backpack is used, otherwise we return backpack is new meaning the backpack is really under 30 days old. This is a good example of how conditional statements work. I can now change those to say, backpack age must be less than or equal to 30. Then of course I would have to change the logic here to say backpack is new at the top and then backpack is old at the bottom. If I want…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
The real-world function2m 49s
-
(Locked)
Functions and methods6m 23s
-
(Locked)
A standard function3m 53s
-
(Locked)
The arrow function4m 49s
-
(Locked)
Arrow functions and "this"4m 20s
-
(Locked)
Practice: Build a function1m 31s
-
(Locked)
Pass data to a function with parameters4m 56s
-
(Locked)
Return values from a function7m 1s
-
(Locked)
Practice: Pass values between functions2m 33s
-
(Locked)
Callbacks5m 29s
-
(Locked)
Conditional if...else statement5m 52s
-
(Locked)
Logical operators3m 31s
-
(Locked)
Conditional switch statement5m 55s
-
(Locked)
Looping through content5m 19s
-
(Locked)
Using the map() array method4m 52s
-
(Locked)
Challenge intro: Create a content factory2m 36s
-
(Locked)
Solution: Create a content factory5m 21s
-
-
-
-