I have a condition where 0 or more is valid and negative is invalid. When I write code accordingly in JavaScript/TypeScript, to my surprise it's not working the way I expected it to.
The code is as follows.
if (-1) {
  console.log("truthy")
} else {
  console.log("falsy")
}And this prints the following in console.
truthy
It should have be falsy, right?
Any help, helping me understand this behavior. What am I missing?
Thanks
 
     
     
     
    