If-else Statement:-
“JavaScript में if-else स्टेटमेंट का भी उपयोग कोड को executed करने के लिए किया जाता है। चाहे condition सही है या गलत है, if else statement में जब condition true होती है तब if का statement execute होता है और अगर condition false होती है तो else का statement execute होता है।
Syntax:- if (condition)
{
Statement 1;
}
else
{
Statement 2;
}
Question:- 1. Wap to find even or odd number
2. Wap to find greater or smaller number between two numbers.
3. Wap to check positive or negative number.
4. Wap to check student pass or fail.
If-else Statement:-
“If-else statements in JavaScript are also used to execute code. Whether the condition is true or false, in the if else statement, when the condition is true then the if statement is executed and if the condition is false then the else statement is executed.
Syntax:- if (condition)
{
Statement 1;
}
else
{
Statement 2;
}
Question:- 1. Wap to find even or odd number
2. Wap to find greater or smaller number between two numbers.
3. Wap to check positive or negative number.
4. Wap to check student pass or fail.