Recent Posts
Recent Comments
게으른개발너D
[Built-in Objects] 까먹는 것 정리 본문
Built-in Objects (표준내장객체)
1. parseInt()
n진수를 10진수로 변환
(문자열 인자를 파싱하여 특정 진수의 정수를 반환)
const numStr = '101';
// 2진수 '101'을 10진수로 변환
const change1 = parseInt(numStr, 2);
console.log(change1);
// output:{number} 5
// 5진수 '101'을 10진수로 변환
const change2 = parseInt(numStr, 5);
console.log(change2);
// output:{number} 26
반대) Number.prototype.toString()
'개발 > JavaScript' 카테고리의 다른 글
[Math] 까먹는 것 정리 (0) | 2023.07.12 |
---|---|
[Number] 까먹는 것 정리 (0) | 2023.07.12 |
Classes - class, extends, super, this (0) | 2023.04.27 |
Async/ Await - async await, try catch finally, parallel async await (0) | 2023.03.30 |
Promises 2 - all, race, finally, fetch (0) | 2023.03.30 |
Comments