While experimenting with JavaScript. I was testing around with some odd little code snippets, here are a few of my findings (to help understand how I came upon -0),
While doing +[] in console, this returns 0. I'm not sure why, but it does.
So, this implies the positive of a array is 0..
After doing so, I got curious and tried the following:
console.log(-[]);
And this returns -0...
What is the point of -0? 0 and -0 both hold no value, so the negative is really unnecessary... Or is it? Perhaps JavaScript has a purpose for -0?
Adding onto that. I cannot find any other way to reproduce -0 other than using -0 itself, or using -[]...
Some other weird findings, furthing my question of -0
(-0) + (-0) = 0
(-0) - (-0) = -0
(-0) * (-0) = 0
(-0) / (-0) = NaN // of course