题解 | #二进制转换#

二进制转换

https://www.nowcoder.com/practice/7b74386695cc48349af37196f45e62a8

    function convertToBinary(num) {
        let res = num.toString(2).split('');
        while (res.length < 8) {
            res.unshift('0')
        }
        return res.join('');
    }

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务