Skip to content

Instantly share code, notes, and snippets.

@appoll
Created November 23, 2020 17:50
Show Gist options
  • Save appoll/4e7f1ab9bdbd8c955a80e461859c0753 to your computer and use it in GitHub Desktop.
Save appoll/4e7f1ab9bdbd8c955a80e461859c0753 to your computer and use it in GitHub Desktop.
// E2. You are given an array of user objects:
// 2.1 Print the name of the first user in the array
// 2.2 Print the age of the last user in the array
// 2.3 Find the name of the oldest user in the array
// 2.4 Find the name of the oldest user who is also german
let user1 = {
firstName: "Paul",
lastName: "Anton",
// age:
// germanCitizenship:
};
let user2 = {
firstName: "Oliver",
lastName: "G"
};
let user3 = {
firstName: "Gabriela",
lastName: "M"
};
console.log(user1)
console.log(user2)
console.log(user3)
users = [user1, user2, user3];
console.log(`There are ${users.length} objects in the users array.`);
console.log("The first user object in the array is: ");
console.log(users[0]);
// for (...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment