I am making a Discord bot that states accounts in it, but for some reason, my code is outputting undefined errors in it. I want to make it so there are no undefined errors. It is not an error necessarily, but it says Undefined along with what we want in there, and we want to remove the Undefined message COMPLETELY. Images are linked below along with the not working code.
if(msg.startsWith(`${prefix}gen choice`)) {
if(message.channel.type == "text") {
let result3 = Math.floor((Math.random() * accounts3.length))
let acc3embed = new Discord.MessageEmbed()
.setAuthor('Test Bot', 'https://cdn.discordapp.com/attachments/421820457587703812/736328588500140102/264855.png')
.setColor('#49a5bf')
.setTitle("Choice Succesfully generated!")
.setDescription('Here is your choice!')
.setTimestamp()
.addField('' + accounts3[result3] + "")
.addField('-------------------------------------------------', "**Want cool things? Click the link below!**\n Enter Website Here")
.setFooter("Test Bot");
message.author.send(acc3embed);
message.reply("I've sent you the choice! Please check your DMs!!")
}[enter image description here][1]
}
Here is the image: https://i.sstatic.net/ayR69.jpg
Please help me! Thank you!
console.log(accounts3[result3])produce?accounts3[result3]is undefined, so figure out why that is undefined if it's supposed to be something, or remove that line completely.console.log(accounts3[result3])?