This is the code which I wrote but I don’t know how to return the names and make them an array
const objects = [
{
name: "John",
age: 30
},
{
name: "Mike",
age: 23
}
];
const object = () => {
Object.values(objects).forEach (element => {
let names = element.name;
console.log(names);
});
};
object();