toFixed()
const PI = 3.14159265;
console.log(PI.toFixed(2));
console.log(PI.toFixed(5));
console.log(typeof PI.toFixed(2));
console.log(typeof Number(PI.toFixed(2)));
/*
출력
---
3.14
3.14159
string
number
*/
toString()
const num = 255;
console.log(num.toString(2));
console.log(num.toString(8));
console.log(num.toString(16));
console.log(typeof num.toString(2));
console.log(typeof Number(num.toString(2)));
/*
출력
---
11111111
377
ff
string
number
*/
Tomorrow better than today, Laugh at myself
- 출처 -