How can I select a random value from this array using JavaScript for discord bot?
var a = [ "lekh","lol"];
bot.on('message', msg=> {
    if(msg.content == "kilka" ){
        msg.reply( Math.floor(Math.random() * a.length ));
    } 
})
How can I select a random value from this array using JavaScript for discord bot?
var a = [ "lekh","lol"];
bot.on('message', msg=> {
    if(msg.content == "kilka" ){
        msg.reply( Math.floor(Math.random() * a.length ));
    } 
})
 
    
     
    
    You should change:
msg.reply( Math.floor(Math.random() * a.length )); to
msg.reply(a[Math.floor(Math.random() * a.length)]); to actually select the item from the a array
