题解 | #二进制转换#
二进制转换
https://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8
function convertToBinary(num) {
const str = num.toString(2)
return str.length < 8 ? '0'.repeat(8-str.length)+str : str
}
二进制转换
https://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8
function convertToBinary(num) {
const str = num.toString(2)
return str.length < 8 ? '0'.repeat(8-str.length)+str : str
}
相关推荐