Adding an array to embed fields

const {  SlashCommandBuilder, EmbedBuilder  } = require("discord.js")
const { getTodos } = require("../../firebase.js");

module.exports = {
    data: new SlashCommandBuilder()
        .setName("todues")
        .setDescription("Gets a list of ToDues"),
    async execute(interaction){
        const todoEmbed = new EmbedBuilder()
            .setColor("DarkVividPink")
            .setDescription("A list of all your todos.")
        try {
            const userId = interaction.user.id;
            await interaction.deferReply(); 

            const todos = await getTodos(userId);
            
            await interaction.editReply({embeds: [todoEmbed]})
        } catch (error) {
            console.error(error);
            await interaction.editReply("An error occurred while fetching tasks.");
        }
    },
}     

"todos" returns an array that follow the same structure that the fields of an embed use. I want to this as the "name" and "value" of the field how can I achieve this?
Was this page helpful?