Question

function myFuntion(stringNumber){
    var number=parseFloat(stringNumber);
}

The value of stringNumber is "38,41" (the type of this is string) and i want to convert it float. but when i debug the code i see that this converted to the "38" like parseInt. why? can be it derives from server?

Était-ce utile?

La solution

May be you are passing 38,41 instead of 38.41. If so parseFloat will return 38

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top