I have an object in which I want to be able to dynamically add at least one property. The amount of properties depends on the items inside of an array that I have. Here's the object I'm referencing:
const helpEmbedMsg = new global.Discord.MessageEmbed()
// Display a different (random) color every time the command is used.
.setColor("RANDOM")
.setTitle("Help")
.setAuthor("Beatrice~")
.setDescription("A full list of the commands available to you..")
.addFields(
{ name: `The current __prefix__ for this server is: \`${prefix}\``, value: "\u200B" },
)
.addField("📋 Here's a list of all my commands:", "\u200B", false)
.addField("\u200B", "\u200B", false)
.addField(`Type \`${prefix}help <command>\` to learn more about a command and it's usage! `, `Example: \`${prefix}help ping\``, false)
.setTimestamp()
.setFooter(`Command triggered in ${message.channel.guild}`);
So, basically, if the length of the array is 4, I want to add the following:
.addField(array[i], "text here", true)
four times, but in a specific place in the object (the order counts), right below this line:
.addField("📋 Here's a list of all my commands:", "\u200B", false)