18日目TILレビュー

436 ワード

パートナー(新しい方法)
小数点を表すtoFixed関数(戻り値は文字列)
const number = 12345.6789; console.log(number.toFixed()); 
// “12346” 

소수점 1의 자리에서 반올림 console.log(number.toFixed(2)); 
// “12345.68” 

소수점 3의 자리에서 반올림 console.log(number.toFixed(6)); 
// “12345.678900” 빈 공간은 0으로 채워짐
Object.fromEntries(arr)
:Object.entries(obj)の反対です.[[키, 값], [키, 값], [키, 값]] --> {키: 값, 키: 값, 키: 값}振り返る