Conditional statements in Javascript
Arya Krishna
Posted on May 9, 2022
Any set of code which can help us achieve a result can be referred to as algorithm. Here the conditional statements are our first introduction or building block to solving algorithms. We have already discussed about data types and storing data in a variable. We will gradually understand that in programming everything comes back to basic datatypes.
An if statement is comprised of the if
keyword followed by a set of parentheses
and inside of those parentheses is where we put our expressions that is the true or false check. After the parentheses we have the opening and closing of the curly braces
which is called the body of if statement. Anything inside the body runs only if the conditions mentioned by the if statement is true.
if (condition) {
// block of code to be executed if the condition is true
}
Posted on May 9, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.