2

greater than or equal than >= and lower than or equal than <= strict versions in JavaScript? Similar to === and !==.

example:

false >= 0
true
false >== 0
VM174:2 Uncaught SyntaxError: Unexpected token =(…)

For "Y you will ever need it?"

!undefined >= 0 // some bad code like this in 10000 rows for example
true

example of defined strict versions, greater or equal than strict and respectively the other way around can be defined too.

function gtEStrict(arg1,arg2){
  if ( typeof arg1 === typeof arg2 ) {
     if ( arg1 >= arg2 ) {
       return true;
     }
  }
  return false;
}

gtEStrict(0,0)
true
gtEStrict(!undefined,0)
false
Vitaliy Terziev
  • 6,429
  • 3
  • 17
  • 25

2 Answers2

4

Long story short, no. These operators do not exist.

molson504x
  • 1,180
  • 10
  • 18
1

Ok, let's assume, that comparing operator a >== b exist. When it return false, what does it mean? a less than b or a does not strictly equals to b? You can read more in that anwser.

Community
  • 1
  • 1
ZhukovRA
  • 506
  • 1
  • 3
  • 17
  • i will mark this an answer because of the link :) (good one). Obviously there is no standard operator for my question i was curious if someone faced this and waned to make quick dirty fix or checker ;) – Vitaliy Terziev Feb 02 '16 at 20:54
  • ah this will be confusing for beginners :) replacing with +1 and changing my answer to @molsons's – Vitaliy Terziev Feb 02 '16 at 20:57