题解 | #二进制转换#
二进制转换
http://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8
function convertToBinary(num) { let a = num.toString(2) let i = 8 - a.length let str0 = '' for (; i > 0; i--) { str0 += '0' } return str0 + a }
二进制转换
http://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8
function convertToBinary(num) { let a = num.toString(2) let i = 8 - a.length let str0 = '' for (; i > 0; i--) { str0 += '0' } return str0 + a }
相关推荐