美文网首页
随机数组元素(案例)

随机数组元素(案例)

作者: QinHaolei | 来源:发表于2019-11-05 16:15 被阅读0次
        var arr = ["元素0", "元素1"];
        
        var index = Math.floor(Math.random() * arr.length + 1) - 1;
        
        console.log('随机数组元素'+arr[index]);
    

    相关文章

      网友评论

          本文标题:随机数组元素(案例)

          本文链接:https://www.haomeiwen.com/subject/zbkjbctx.html