📜  javascript random char - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:11.180000             🧑  作者: Mango

代码示例2
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
function generateRandomCode(){
    let result = ""
    let charactersLength = characters.length;
    for ( var i = 0; i < 6 ; i++ ) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }
    return result
}