How does the following code work, I am lost

I am following this tutorial and I cannot understand the following screenshot function code.

What I don’t understand is that inventory is the object in the data but how the author is using it as an array totally confuses me. How does an array add something to a object?

I am new to Javascript

It isn’t an array. They are using bracket notation.
Here is the lesson on bracket notation:

1 Like

Thank you, sometimes I get really lost.

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