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?
9/20/2021 1:29:17 PMKAZI MD SHAKIB HASSAN
7 AnswersNew Answer
KAZI MD SHAKIB HASSAN because that's not valid operator. not only js even any language doesn't have these operators
Because not less(!<) or no more(!>) equals less(<=)(<) and more(>=)(>) Not equals(!=) It's easy not to repeat it differently
Because !< means >= and !> means <= , so there is no need for these oprators hense they are just bunch of code smells
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 👌
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