HTML List from js array

The goal is to get an unordered list in HTML with numbering first element. I can’t figure out how to get access to values. The maximum that I achieved is that I managed to get the structure of the list.

const users = [
  {
    name: "Michael",
    age: 37,
    email: "michael@michael.com",
  }, {
    name: "Janet",
    age: 29,
    email: "janet@janet.com",
  }, {
    name: "Helene",
    age: 48,
    email: "helene@helene.com",
  }
];

What you have here is a list of objects. As this is the case, you first access an element of the list, and then access it like you would an object. If you want to get all of the elements, then use a loop like the codebyte below.

const users = [ { name: "Michael", age: 37, email: "michael@michael.com", }, { name: "Janet", age: 29, email: "janet@janet.com", }, { name: "Helene", age: 48, email: "helene@helene.com", } ]; let userOneName = users[0].name; let usersEmails = []; for (let i = 0; i < users.length; i++) { usersEmails.push(users[i].email); } console.log(`The first users name is ${userOneName}`); console.log(usersEmails);

Hopefully this is what you were looking for!