Dlaczego 2..toString()
zwraca 2
, ale 2.toString()
zgłasza ten błąd?Dlaczego działa funkcja 2..toString()?
przykład:
console.log(2..toString()); // prints 2
// Firefox throws the error
// `SyntaxError: identifier starts immediately after numeric literal`
console.log(2.toString());
var x = 2;
console.log(x.toString()); // prints 2
// Firefox throws the error
//`TypeError: XML descendants internal method called on incompatible Number`
console.log(x..toString());
(2) .toString() daje oczekiwany wynik. (nie jest to odpowiedź, ale test ...) –
Czy IE również podaje błąd? – DevelopmentIsMyPassion
Wiem, ale dlaczego działa również funkcja "2..toString()"? –