编写一个函数,生成4位数字的验证码

function checkcode(){
        var num = parseInt(Math.random()*9000) + 1000;
        return num;
}
 
function checkcode(){
        var num = 0;
        do{
                num = parseInt(Math.random()*10000);           
        } while( num < 1000);
        return num;
}
原文地址:https://www.cnblogs.com/tis100204/p/10310132.html