有人知道为什么JavaScript的Number.toString
函数不能正确表示负数吗?
//If you try
(-3).toString(2); //shows "-11"
// but if you fake a bit shift operation it works as expected
(-3 >>> 0).toString(2); // print "11111111111111111111111111111101"
我真的很好奇为什么它不能正常工作,或者为什么以这种方式工作?我已经搜索过了,但没有找到任何有用的东西。