When used with a String parameter 'toFixed' produces wrong results for 0:
test("Rounding numbers", function () {
var zero = 0;
equal("0.00", zero.toFixed(2));
//Fails, the result is "0.21"
equal("0.00", zero.toFixed("2"));
});
The second test case fails. I understand that we should provide a number parameter rather than a String, but with the latest IE, Firefox and Chrome both test cases pass so the compatibility with this common browser behavior can be desirable.
Fixed per rev 5cddc79b705a2b81d890c165872910389dcc0917 Also fixed erratic test (0.6).toFixed(1) != '1' that let ample implementation redefine well working native toFixed. Now should only apply in IE before 9
When used with a String parameter 'toFixed' produces wrong results for 0:
The second test case fails. I understand that we should provide a number parameter rather than a String, but with the latest IE, Firefox and Chrome both test cases pass so the compatibility with this common browser behavior can be desirable.