DEV Community

Cover image for More Conditional Statement – JavaScript Series – Part 9
Muhammad Ali (Nerdjfpb)
Muhammad Ali (Nerdjfpb)

Posted on • Originally published at

More Conditional Statement – JavaScript Series – Part 9

In last part we didn’t talk much about conditions. In this part we are going to talk about the conditions.

Suppose we need to found a value which is divisible by 5 and 7 both. How can we do this? The straight forward way will be just write one if inside of another one. Example –

Alt Text

Now we can do two conditions in one if. By adding && we can do it. Adding && means we need to satisfy both conditions to go that block. Example –

Alt Text

Now lets suppose we a string value which is midoriya or todoroki. If we get any of these, then we’ll tell this is coming from BHNA anime, or else we will print, we don’t know the sources. Let’s do it.

First we need a name variable and store the value in it –

Alt Text

Now lets check the both condition and put || between them. This means OR. If any of these condition approved, then if block will run.

Alt Text

So this was easy right ?

We learned about && which means and. Also we learn about || which means or.

Let me know if you have any questions.

You can see the graphical version here

Source Codes - { Check commits }

GitHub logo nerdjfpb / javaScript-Series

A tutorial for JavaScript Beginners


A tutorial for Absolute Beginners of JavaScript.

You can find the total pdf in - Here

You can check the commits to find the part by part codes.


Day 1
  • Day 1 - What is JavaScript?
Day 2
  • Day 2 - JavaScript Types?
Day 3
  • Day 3 - Javascript Types Cont.
Day 4
  • Day 4 - Javascript Types Cont.
Day 5
  • Day 5 - Javascript Comparisons
Day 6
  • Day 6 - Javascript Variables
Day 7
  • Day 7 - More About Variables
Day 8
  • Day 8 - Conditional Statement
Day 9
  • Day 9 - More Conditional Statement
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17

Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin!

Top comments (0)