JavaScript Operators & JavaScript Conditionals | JavaScript Tutorial #4
Skills:
Prompt Craft80%Advanced Prompting70%Prompt Systems Engineering60%Agent Foundations50%Tool Use & Function Calling50%
Key Takeaways
This video tutorial covers JavaScript operators and conditionals, including comparison operators, logical operators, and if-else statements, using simple examples and visualizations to help beginners learn.
Full Transcript
in this video you will learn with very simple examples and visualizations everything about conditionals and comparison operators in JavaScript so first let's see what comparison operators are let's consider as an example Facebook feature to display birthdays of its users so basically if today is your birthday Facebook will show a birthday icon and will send notifications to all your friends and for Facebook to check whether it's your birthday today basically it has to compare today with your birthdate right so that comparison or equals in JavaScript is expressed with 3 comparison sites like this so one comparison sign is reserved for assigning variables as we saw in one of my previous videos of variables so double or triple equal signs are used to check the Equality of two values so it's the difference between the two so let's say I have a variable age 30 so if I compare value of variable age to 30 then I get true right if I triple compare that I also get true so same results now if I compare the value with a string representation of 30 I also get true however if I triple check I get false and this is a difference between these two the double comparison checks equality of the values on tooth sides so checks the value here checks the value here and compares them by the value the triple equality compares value and also the type the data type of those values so if I have a number here and a number here which are same values then it's going to be true if I have a number value here which is defined here and a string value here of the same value I get false because the data types are not the same so that's the difference and obviously if I put here another value it's gonna be false in any case right like this or like this doesn't really matter and that little difference can actually have a big impact that's why these concept is important in JavaScript general rule is that you should in most cases use the triple equation to compare two values now let's consider another example where you order something on Amazon it says that shipping is free above purchase of 20 euros so when you add things to your cart program checks whether your order total is above 20 or below 20 and then calculates the shipment costs based on that and let's say charges you 5 euros if your if your total order is under 20 euros so now we don't have the equal check anymore but rather is it higher or is it lower so the way to check that is let's clear these so let's define variables so you have the total price let's say you gathered items that are 19 euros and now the program checks if total price is greater than 20 euros you get a boolean expression of false because this condition is wrong in the same way the program can also check the opposite direction so you can check whether your total price is below 20 but notice that we don't check for value 20 so what happens if the total price is exactly 20 so basically here we need to check that if total price is below 20 or 20 euros in both cases you get charged for the shipping so in order to do that you can combine those two expressions and say like this so either it should be less than 20 or to be exactly 20 for that to be true and as you see each of these comparisons return to you a boolean expression of either or true only one of these outcomes is possible so what this means is that in the program you check if this condition comes out as true then you want to offer free shipping otherwise you want to charge five euros for shipping and the way it's going to be written inside of the program using JavaScript syntax is if your price is greater than twenty here will be code that lets say calculates or sets the price of shipping so here we set it to zero there is no shipping cost otherwise is expressed with else shipping cost equals to five euros so this is how the conditions are used in JavaScript to check the condition and based on that divided this or if we switched that condition we can also check if total price is less than or equal to twenty then shipping cost will be set to five otherwise the shipping cost will be zero so to go back to some technical terms in JavaScript this here is called if-else statements whatever is inside if is called a condition so this thing here that evaluates to either true or false is a condition and this here that compares those two values is called a comparison operator so greater smaller equals etc all these are comparison operators but let's say you have a case where you have three different shipping costs right so for example if the price is below ten euros you get charged five euro shipping costs if it's below twenty you get charged only three euros and if it's above twenty you get charged nothing now you don't have if-else only but you have three conditions it's also super simple to do that with if-else so basically you check again if total price is less than or equal to ten you get charged five euros and here you are gonna say else/if which is another statement where you can write the conditional where we're gonna check where the total price is less than or equal to 20 in that case you get charged three euros and there comes our final else which is zero so now I have three conditions here so the first condition here says it's less than or equal to ten the first one checks another condition and the third one important thing to note here that the last else or the the else here doesn't have a condition explicitly but it implies that both of these above conditions were false so both of them were wrong B and because it's implicit we don't have to check it explicitly here so you could also go here and do that else if price is greater then 20 and this will work just fine however because it's implicit we don't need that so we sell comparisons between two values using equals higher or lower the final operator is not equals for example consider a feature where a web application checks whether user is a Premium Member or not obviously if you are not a premium user you won't see the cool features they have or you won't be able to access some premium content so when you log in program will check is user membership premium so with equals or it can check use a membership not premium and in order to express that negative comparison you use this syntax so not equals in JavaScript is expressed with exclamation mark and double equals and to show that in if-else statements let's say if user membership is not premium show user non-premium contents or maybe even recommend a premium upgrade as a marketing measure and else show premium contents and finally you can combine all these conditions so for example if today is your birthday and you have displayed that on your profile only then the program will show the notification so both conditions must be true so if today state is the same as your birth date and birthday displayed is true so here you can use a comparison with boolean true or false so both these conditions must be true for notification to be sent and in JavaScript the syntax for end is this so this basically is also a valid condition that you can also put inside of the if condition so if this whole thing is true then show notification else do not or another example back to the shipment cost let's say you don't pay for the shipment if the total price is over 20 euros or you have Amazon Prime account so the way to express that would be total price over 20 euros or amazon prime equals so here only one of them has to be true for you to get free shipment or in JavaScript is expressed with double pipes and again you can put that in if statement and say if either this or this is true then give a free shipment otherwise don't and you can also use negation in conditions for example you want to check whether this whole thing is false and the way to do that is using the exclamation mark and the brackets so basically this will check whether this whole condition is false now even if you understood all this concept it's always a good idea to practice them yourself so that you get it better so because of that I'm gonna put a link to practical exercises for conditionals and competitors in the video description below so make sure to check that out and practice yourself with a couple of examples and once you do that you can come back for another JavaScript video and if you don't want to miss that you can subscribe to my channel and click the notification bell so that you can notified when the next video is out so thanks for watching and see you in the next video
Original Description
Learn JavaScript Operators and JavaScript Conditionals | JavaScript if else statement
► Subscribe to me on Youtube: https://bit.ly/2z5rvTV
In this video you will learn with simple examples and visualizations everything about conditionals, comparison operators and logical operators in JavaScript.
I explain in detail:
❶ what comparison operators are, like equality and greater/less than and how to use them.
❷ Next I show how if else statements in javascript work and also explain why those javascript conditionals are useful.
➌ Last but not least you will learn logical operators, which combine conditionals.
__________________________________________________________________________
0:10 - Comparison Operators - equals, greater and less
4:20 - JavaScript Conditionals (if else statement)
7:55 - Comparison Operators - not equals
9:05 - Logical Operators
► For practicing 👩🏻💻:
- https://www.w3schools.com/js/js_comparisons.asp
- https://www.w3schools.com/js/js_if_else.asp
►► This is a complete JavaScript Tutorial for Beginners 💪🏼. If you are completely new to programming this will give you a step by step guide to learn JavaScript basic concepts and syntax. Subscribe or turn on the bell notification so you don't miss the new videos. 🙂
__________________________________________________________________________
💡 Maybe also interesting for you:
JavaScript Full Course here ► https://bit.ly/34yUrzj
Top 3 programming languages | meta analysis ► https://youtu.be/9e6sUNhAB4M
How websites work ► https://youtu.be/vcRmKtL4o_4
► For any questions/issues/feedback 💡, please leave me a comment and I will get back to you as soon as possible. Also please let me know what you want to learn about JavaScript or web development in general.
#javascript #js #webdevelopment #softwaredevelopment #coding #techworldwithnana #programming
----------------------------------------------------------------
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from TechWorld with Nana · TechWorld with Nana · 40 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
▶
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Docker? Docker container concept explained || Docker Tutorial 1
TechWorld with Nana
What is a Docker Container? Docker Demo || Docker Tutorial 2
TechWorld with Nana
How to install docker? Step by Step || Docker Tutorial 3
TechWorld with Nana
8 Basic Docker Commands || Docker Tutorial 4
TechWorld with Nana
Debugging Docker Containers with docker exec and docker logs || Docker Tutorial 5
TechWorld with Nana
Docker vs Virtual Machine | simply explained || Docker Tutorial 6
TechWorld with Nana
Overview of Workflow with Docker - Docker in Practice || Docker Tutorial 7
TechWorld with Nana
Developing with Docker - Docker in Practice || Docker Tutorial 8
TechWorld with Nana
Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9
TechWorld with Nana
Dockerfile Tutorial - Docker in Practice || Docker Tutorial 10
TechWorld with Nana
Private Repository explained | Registry on AWS - Docker in Practice || Docker Tutorial 11
TechWorld with Nana
Docker Volumes explained in 6 minutes
TechWorld with Nana
Deploying the containerized application with Docker Compose || Docker Tutorial 12
TechWorld with Nana
Docker Volumes Demo || Docker Tutorial 13
TechWorld with Nana
Docker vs Kubernetes vs Docker Swarm | Comparison in 5 mins
TechWorld with Nana
What is Kubernetes | Kubernetes explained in 15 mins
TechWorld with Nana
Kubernetes Components explained! Pods, Services, Secrets, ConfigMap | Kubernetes Tutorial 14
TechWorld with Nana
Kubernetes Architecture explained | Kubernetes Tutorial 15
TechWorld with Nana
Benefits of Kubernetes | Scalability, High Availability, Disaster Recovery | Kubernetes Tutorial 16
TechWorld with Nana
Minikube and Kubectl explained | Setup for Beginners | Kubernetes Tutorial 17
TechWorld with Nana
Top 3 programming languages to learn in 2020 | meta analysis
TechWorld with Nana
Kubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18
TechWorld with Nana
Kubernetes YAML File Explained - Deployment and Service | Kubernetes Tutorial 19
TechWorld with Nana
Run Jenkins in Docker Container - Jenkins Pipeline Tutorial for Beginners 1/4
TechWorld with Nana
Create Multibranch Pipeline with Git - Jenkins Pipeline Tutorial for Beginners 2/4
TechWorld with Nana
Jenkinsfile - Jenkins Pipeline Tutorial for Beginners 3/4
TechWorld with Nana
Trigger Jenkins Build automatically - Jenkins Pipeline Tutorial for Beginners 4/4
TechWorld with Nana
Complete Application Deployment using Kubernetes Components | Kubernetes Tutorial 20
TechWorld with Nana
Kubernetes Namespaces Explained in 15 mins | Kubernetes Tutorial 21
TechWorld with Nana
Configure Build Tools in Jenkins and Jenkinsfile | Jenkins Tutorial
TechWorld with Nana
Complete Jenkins Pipeline Tutorial | Jenkinsfile explained
TechWorld with Nana
Kubernetes Ingress Tutorial for Beginners | simply explained | Kubernetes Tutorial 22
TechWorld with Nana
What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23
TechWorld with Nana
How Websites Work | simply explained with examples
TechWorld with Nana
What is JavaScript? | JavaScript Tutorial #1
TechWorld with Nana
What is Ansible | Ansible Playbook explained | Ansible Tutorial for Beginners
TechWorld with Nana
JavaScript Variables & JavaScript Data Types explained | JavaScript Tutorial #2
TechWorld with Nana
How Prometheus Monitoring works | Prometheus Architecture explained
TechWorld with Nana
Where to write JavaScript | Where to execute JavaScript Code | JavaScript Tutorial #3
TechWorld with Nana
JavaScript Operators & JavaScript Conditionals | JavaScript Tutorial #4
TechWorld with Nana
Pods and Containers - Kubernetes Networking | Container Communication inside the Pod
TechWorld with Nana
Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class
TechWorld with Nana
Kubernetes ConfigMap and Secret as Kubernetes Volumes | Demo
TechWorld with Nana
Pull Image from Private Docker Registry in Kubernetes cluster | Demo
TechWorld with Nana
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
TechWorld with Nana
Yaml Tutorial | Learn YAML in 18 mins
TechWorld with Nana
Terraform explained in 15 mins | Terraform Tutorial for Beginners
TechWorld with Nana
Setup Prometheus Monitoring on Kubernetes using Helm and Prometheus Operator | Part 1
TechWorld with Nana
Managed Kubernetes Cluster explained | Kubernetes on Cloud (1/2)
TechWorld with Nana
Step by Step Application Deployment on LKE using Helm | Kubernetes on Cloud (2/2)
TechWorld with Nana
Kubernetes Operator simply explained in 10 mins
TechWorld with Nana
What is Infrastructure as Code? Difference of Infrastructure as Code Tools
TechWorld with Nana
AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way
TechWorld with Nana
Prometheus Monitoring - Steps to monitor third-party apps using Prometheus Exporter | Part 2
TechWorld with Nana
GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
TechWorld with Nana
Docker Tutorial for Beginners [FULL COURSE in 3 Hours]
TechWorld with Nana
Kubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless Service
TechWorld with Nana
Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours]
TechWorld with Nana
Containers on AWS Overview: ECS | EKS | Fargate | ECR
TechWorld with Nana
Kubernetes is dropping Docker support - What does it mean for YOU?
TechWorld with Nana
More on: Prompt Craft
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Had my Frontend Developer interview with Capgemini (Application Developer) today, and I wanted to…
Medium · JavaScript
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · Programming
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · JavaScript
The US Frontend Engineer Market in 2026: A Data-Driven Reality Check (and the Bias That Stops Us Seeing It)
Dev.to AI
Chapters (4)
0:10
Comparison Operators - equals, greater and less
4:20
JavaScript Conditionals (if else statement)
7:55
Comparison Operators - not equals
9:05
Logical Operators
🎓
Tutor Explanation
DeepCamp AI