Given an array of user objects.
let names = []
let users = [
{ name: "John", email: "[email protected]" },
{ name: "Jason", email: "[email protected]" },
{ name: "Jeremy", email: "[email protected]" },
{ name: "Jacob", email: "[email protected]" }
]
for(/* add code inside these parenthesis only */) {
names.push(name)
}
console.log(names) // should log ["John", "Jason", "Jeremy", "Jacob"]
Push the first names of all users in the names array.
const str assignment. This is only used for validation purposes.