如何为数组中的每个对象添加一个新字段?

How do I add a new field for every object in the array?

如何向 articles 数组中的每个对象添加新的 shortText 字段?

articles.forEach((article) => {
        request(article.link, (err, response, html) => {
          if (!err && response.statusCode == 200) {
            const $ = cheerio.load(html);
            const textData = $('.ssrcss-hmf8ql-BoldText');
            textData.each((index, element) => {
              article.shortText = $(element).text();
            });
          }
        });
      });

示例文章数组

[
  {
    headline: 'Scale of Russian mercenary mission in Libya exposed',
    link: 'https://bbc.com/news/world-africa-58009514'
  },
  {
    headline: 'Afghan president rallies Taliban-besieged city',
    link: 'https://bbc.com/news/world-asia-58170847'
  }
]

我想遍历上面的数组并为每个对象添加 shortText 字段

//add fullname field in array of objects

/*
arrayOfObjects =arrayOfObjects.map((instanceObject) => ({
        ...instanceObject,
        newfield : values,
        }))
*/

const getUsers = async () => {
  const response = await fetch(
    "https://www.json-generator.com/api/json/get/cfrfjgAOIy?indent=2"
  );
  let users = await response.json();

  users = users.map((person) => ({
    ...person,
    fullname: `${person.firstName} ${person.lastName}`,
  }));

  console.log(users);
};

getUsers();