Warum gibt 2..toString()
zurück 2
aber 2.toString()
wirft diesen Fehler?Warum funktioniert 2..toString()?
Beispiel:
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() liefert das erwartete Ergebnis. (keine Antwort aber ein Test ...) –
Gibt IE auch Fehler? – DevelopmentIsMyPassion
Ich weiß, aber warum funktioniert '2..toString()' auch? –