x자리 소숫점으로 만들때 사용하는 방법으로 속도가 빠르다는 장점이 있다.

const n = ~~(12.123344) / 100;
console.log(n); // 0.12

출처: https://www.measurethat.net/Benchmarks/Show/5545/0/tofixed-vs-toprecision-vs-mathround-vs-mathfloorfast

메타데이터

조회수
531
좋아요
0

0개의 댓글

등록된 댓글이 없습니다.