➤ How to Code a Game
➤ Array Programs in Java
➤ Java Inline Thread Creation
➤ Java Custom Exception
➤ Hibernate vs JDBC
➤ Object Relational Mapping
➤ Check Oracle DB Size
➤ Check Oracle DB Version
➤ Generation of Computers
➤ XML Pros & Cons
➤ Git Analytics & Its Uses
➤ Top Skills for Cloud Professional
➤ How to Hire Best Candidates
➤ Scrum Master Roles & Work
➤ CyberSecurity in Python
➤ Protect from Cyber-Attack
➤ Solve App Development Challenges
➤ Top Chrome Extensions for Twitch Users
➤ Mistakes That Can Ruin Your Test Metric Program
Greater Than Or Equal To (>=) Operator in JavaScript | A comparison operator known as the greater than or equal to sign is used to determine whether the value of the left operand is greater than or equal to the value of the right operand.
The result is “true” if the left operand’s value is greater than or equal to the right operand’s value. Greater than or equal to is denoted by the sign >=. JavaScript also contains less than equal to (<=) operator.
console.log(10 >= 5);
Output:-
true
console.log(4 >= 5);
Output:-
false
const a = 2;
const b = 5;
// greater than or equal operator
const c = b >= a;
console.log(c); //true
Output:-
true
Here, const a is less than const b, thus we got true as the output.
const a = 5;
const b = 2;
// greater than or equal operator
const c = b >= a;
console.log(c); //true
Output:-
false
In this example, const a is greater than const b, thus the result is false.
const a = 5;
const b = 5;
// greater than or equal operator
const c = b >= a;
console.log(c); //true
Output:-
true
Since it is greater than or equal to >= operator, the same values of the const a, b will output true. Therefore, we saw how to check if the given numbers are greater than or equal to in JavaScript.
Compare Two Characters Using JavaScript greater than or equal to (>=) Operator
console.log('a' >= 'a');
console.log('a' >= 'b');
Output:-
true
false
Compare Two Strings Using JavaScript greater than or equal to (>=) Operator
console.log("Hello" >= "Hi");
console.log("Python" >= "Java");
console.log("React" >= "React");
Output:-
false
true
true
Compare bigint to number Using JavaScript greater than or equal to (>=) Operator
We can also compare bigint to number. Note that bigint is not supported in all browsers.
console.log(5n >= 2);
Output:-
true
If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!