문제

So I got why to fixed returns a String, with this in mind is it possible to cast the "NaN" string into NaN to keep the following expression workable?

var numberWithPrecission = (1*"A").ToFixed(2) || 0; 
도움이 되었습니까?

해결책

As suggested:

var numberWithPrecission = (1*"A" || 0).toFixed(2); 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top