【每日一练】两个数字长度一致,不一致的前面加0补齐

function padding0ToHeader(num1,num2){
    let a = num1.toString()
    let b = num2.toString()
    let maxLength = Math.max(a.length,b.length)
    a=a.padStart(maxLength,0)
    b=b.padStart(maxLength,0)
    return [a,b]
}
posted @ 2020-04-22 23:28  jser_dimple  阅读(188)  评论(0编辑  收藏  举报
/*function gotourl() { var url = "https://www.cnblogs.com/smart-girl/"; var localurl = document.url; if( localurl.substring(0,url.length) != url ) { location.href=url; } } gotourl();*/