SOURCE

function writeDocument(variable) {
    document.write(variable + "<br/>");
} 

writeDocument("最大值"+Math.max(344,142,34,124,412));

writeDocument("最小值"+Math.min(344,142,34,124,412));

writeDocument("取整"+Math.floor(1.7));

writeDocument("取整"+Math.floor(-1.7));

writeDocument("生成随机码----------------------------");

function getcode(length){
    var code="";
    var str="0123456789ABCDEFGHIKLMN";
    for(var i=0;i<length;i++){
        var randomNumber=Math.floor(Math.random()*str.length);
        code=code+str.charAt(randomNumber);
    }
    return code;
}

//随机颜色
function getcolor(){
    var r;
    r=Math.floor(Math.random()*256);
    var g;
    var b;
    for(var i=0;i<3;i++){
         if(i=1){
            g=Math.floor(Math.random()*256);
        }
         if(i=2){
            b=Math.floor(Math.random()*256);
        }            
    }
    document.write("rgb("+r+","+g+","+b+")");
}

getcolor();






console 命令行工具 X clear

                    
>
console