Hi,
bool = bool || (value.indexOf('.') != -1);
bool = bool || (value.indexOf(",") != -1);
* value ist *nicht* numerisch, wenn kein Punkt darin vorkommt
* value ist *nicht* numerisch, wenn kein Komma darin vorkommt
ah, sorry, mein Fehler: Ich hatte das != in Gedanken als == gelesen.
Du hast also ein Logikproblem. Deine Funktion verlangt, dass isNaN() nicht zutrifft, gleichzeitig aber mindestens ein Punkt und ein Komma im String vorkommt.
Dann ist meine Schlussfolgerung natürlich falsch: Deine Funktion verlangt, dass isNaN() nicht zutrifft und *kein* Punkt sowie *kein* Komma vorkommt. Also doch eher das, was Gunnar schon abgeleitet hat.
Übrigens: Eingaben wie 5E-3 (also 0.005) würden ungestreift durchgehen ...
Ciao,
Martin
--
Success should be measured not so much by the position that one has reached in life,
but by the obstacles one has overcome while trying to succeed.
Selfcode: fo:) ch:{ rl:| br:< n4:( ie:| mo:| va:) de:] zu:) fl:{ ss:) ls:µ js:(
Success should be measured not so much by the position that one has reached in life,
but by the obstacles one has overcome while trying to succeed.
Selfcode: fo:) ch:{ rl:| br:< n4:( ie:| mo:| va:) de:] zu:) fl:{ ss:) ls:µ js:(