js
文字列の取り扱い5
桁数指定
console.log((0.12345).toFixed(3)); //0.123
console.log((123.45).toFixed(1)); //123.5(近似値になる)
console.log((1.5).toFixed(5)); //1.50000(桁が足りないときはゼロ)
指定桁数の精度
console.log((0.44455).toPrecision(2)); //0.44
console.log((0.44455).toPrecision(3)); //0.445
console.log((123.456789).toPrecision(4)); //123.5
console.log((12).toPrecision(4)); //12.00