Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top