Hacker News new | ask | show | jobs
by vel0city 2241 days ago
Maybe its a failure of the language when it takes a third party package to determine if a number is greater than or less than zero?
2 comments

> Maybe its a failure of the language when it takes a third party package to determine if a number is greater than or less than zero?

It's not a failure of the language. Javascript has comparison operators like every other language, it's entirely possible to determine if a number is greater than or less than zero without importing a third-party package.

What it is is a failure of modern JS development culture, because apparently it's anathema to even write a simple expression on your own rather than import a dependency tree of arbitrary depth and complexity and call a function that does the same thing.

Their code would have been wrong even in strongly typed languages because it considered 0 to be a negative number. What language prevents you from making that mistake?