Skip to content

Commit df3734e

Browse files
authored
Update javascript_for_web.js
comparison operators
1 parent fbcafbe commit df3734e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

javascript_for_web.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,3 +768,50 @@ testLessOrEqual(10);
768768

769769

770770
//comparison with Logical and Operator &&
771+
//comparison with Logical and Operator &&
772+
//checks if the number's logic is satisfied
773+
//or operator return a True when either of the values are true otherwise false;
774+
//Else statemets. Execute next command if the value is false, others true
775+
if (num > 5 && num < 10) {
776+
return "Yes";
777+
}
778+
return "No";
779+
780+
function testLogicalAnd(val) {
781+
if (val >5 && val <20) {
782+
return "Yes";
783+
}
784+
return "No";
785+
}
786+
console.log(testLogicalAnd(100)); // No
787+
788+
function tester(num){
789+
if(num> 2 && num < 5){
790+
return "yeeeeees";
791+
}
792+
return "Noo";
793+
}
794+
console.log(tester(3)); //yes
795+
796+
function testLogicalAnd(val) {
797+
if (val <=50 && val >=25) {
798+
return "Yes";
799+
}
800+
return "No";
801+
}
802+
console.log(testLogicalAnd(0)); // No
803+
console.log(testLogicalAnd(24)); // No
804+
console.log(testLogicalAnd(25)); // Yes
805+
console.log(testLogicalAnd(30)); // yes
806+
console.log(testLogicalAnd(50)); // yes
807+
console.log(testLogicalAnd(51)); // No
808+
console.log(testLogicalAnd(75)); // No
809+
console.log(testLogicalAnd(80)); // No
810+
811+
//logical or operator:
812+
if (num > 10 || num < 5) {
813+
return "No";
814+
}
815+
return "Yes";
816+
817+
//If Else statemments

0 commit comments

Comments
 (0)