SOURCE

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

writeDocument("最大值" + Math.max(1, 3, 2, -1));
writeDocument("最小值" + Math.min(2, 6, 1, -1));

function ifyCode(length) {
    var strNumber = "0123456789ABCDEFGHIJKLMNOPQRST*&%@!~()";
    var code = "";
    for (var i = 0; i < length; ++i) {
        var randomNumber = Math.floor(Math.random() * strNumber.length);
        code = code + strNumber.charAt(randomNumber);
    }
    return code;
}

writeDocument(ifyCode(4));

var red = Math.floor(Math.random() * 255);
var green = Math.floor(Math.random() * 255);
var blue = Math.floor(Math.random() * 255);
writeDocument("RGB(" + red + "," + green + "," + blue + ")");
console 命令行工具 X clear

                    
>
console