+ 3

Why !< or !> not works, where != works?

You can say. Use >= and <= instead of !< and !> . but I'm not satisfied with this logic. what is the actual reason of giving error? why js developers not implementing this comparison operator?

20th Sep 2021, 1:29 PM
KAZI MD SHAKIB HASSAN
KAZI MD SHAKIB HASSAN - avatar
7 Respostas
+ 5
KAZI MD SHAKIB HASSAN because that's not valid operator. not only js even any language doesn't have these operators
20th Sep 2021, 1:30 PM
A͢J
A͢J - avatar
+ 4
It is not valid in JavaScript. but it's validated in mathematics. we solve a lot problem in mathematics with this !< and !> operator. didn't we?
20th Sep 2021, 1:36 PM
KAZI MD SHAKIB HASSAN
KAZI MD SHAKIB HASSAN - avatar
+ 3
Because not less(!<) or no more(!>) equals less(<=)(<) and more(>=)(>) Not equals(!=) It's easy not to repeat it differently
20th Sep 2021, 1:35 PM
Kazi
Kazi - avatar
+ 1
Because !< means >= and !> means <= , so there is no need for these oprators hense they are just bunch of code smells
20th Sep 2021, 1:46 PM
Nima
+ 1
I'm guessing the idea of <= and >= (and many more) implementation is based on syntactic inheritance, and it's not a bad idea. After all, learners of a language will find the learning curve to be lessen when languages share things in common, such as these operator symbols. A language inheriting things from its predecessors *might* gain more learners opposed to one that iplements its own unique syntax due to uniformity. Just saying 👌
20th Sep 2021, 2:11 PM
Ipang
+ 1
First I suggest to add [js] tag These operators are not defined in js, and unfortunately js doesn't support operator overload (although there are some libraries to allow that ) due to ecma specifications. Many other languages allows it natively, for example Haskell is one of the most famous for such thing.. e.g. (!<) :: Ord t => t -> t -> Bool a !< b = a >= b 0 !> 0 -> True 0 !< 0 -> True It says : operator !< takes 2 comparable(Ord) variables of same type(t) and return Bool
22nd Sep 2021, 1:16 PM
AZTECCO
AZTECCO - avatar