TIL 18일차 & 회고

ᄋᄋ·2021년 12월 20일
0

코플릿 (새로 알게 된 메소드)

소수점 나타내는 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)의 반대.
[[키, 값], [키, 값], [키, 값]] --> {키: 값, 키: 값, 키: 값}


회고

profile
개발자A

0개의 댓글