题解 | #二进制转换#
二进制转换
http://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8
function convertToBinary(num) {
let res=num.toString(2);
return res.length<8?new Array(8-res.length).fill(0).join('')+res:res;
}二进制转换
http://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8
function convertToBinary(num) {
let res=num.toString(2);
return res.length<8?new Array(8-res.length).fill(0).join('')+res:res;
}相关推荐