Javascript issue array nesting objects

Hello there, I’m having issues on logging some objects I nested into an array. When I try to delete the parenthesis, I believe these are causing the issue.

My question is, any software adds the parenthesis back automatically when I save the project?

function cityTemp(australian) {
      console.log(australian + aussieCities.temperature);
    }

    let aussieCities = [
      (Goulburn = {
        name: "Goulburn",
        country: "Australia",
        language: "English",
        temperature: 17,
        capitalCity: true,
      }),
      (Geraldton = {
        name: "Geraldton",
        country: "Australia",
        language: "English",
        temperature: 14,
        capitalCity: true,
      }),
      (Darwin = {
        name: "Darwin",
        country: "Australia",
        language: "English",
![iFTpI09bKK|614x500](upload://w4MTZnZjEaMj5OuyxUIGw3KcT9d.png)

        temperature: 16,
        capitalCity: true,
      }),
    ];

    aussieCities.forEach(cityTemp);

Please have a look at the screenshot. thank you so much

Array of Objects:

let aussieCities = [
  {
        name: "Goulburn",
        country: "Australia",
        language: "English",
        temperature: 17,
        capitalCity: true,
  },
  {
        name: "Geraldton",
        country: "Australia",
        language: "English",
        temperature: 14,
        capitalCity: true,
  },
  {
    ...
  },
  ...
]

Thank you so much for your reply, I’m quite new on this and I’m still learning, so I would like to know why did you take off the vars off from the objects? I understand that if I state them as " name(var) = { porperty1:atribute}, I’m stating them as vars, but I’d like to know why this is wrong.

When I console log it it, I can see the 3 objects, but these objects appear not to have a name, instead it shows (…) for each object, I can see the properties for each of them but I can’t log them in other way than using the index numbers (0, 1, 2).

Would you please have a look at the screenshot, I’m on the learning process, for a homework I have to deliver, I was asked to make an array, inside this array, I would have to add 3 different objects, each of them with their own properties. thank you for the help, I appreciate it, what I tried to do was to do a multidimensional array but replacing the nested arrays by objects but I know I’m missing something and I don’t know what it is.

Those ellipses are telling you that there are properties in each object. You can see them by clicking on the gray triangle on the left.

I see, thank you, sorry if I’m just dumb about it but, I understand these ellipses are my 3 elements but I was told to name them so that’s why I wrote them as the first example, as my main goal was to use a “forEach” function to log the 3 objects and their 3 temperatures which are one of the values within them.

Do you have still problems with this issue?

Thank you, I solved it some days ago!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.