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