Question: As I know, it is possible to push more data into an array. Fe, I have an array: 

```
G = [12, 34, 5]. 

```

Right now, I can access the nth element like this: 

```
G[n]

```

I'd now like to push new data in it with a label, so I want the array to look like 

```
G = [12, 34, 5, label:567856, other: Infinity]

```

where I can get 567856 by calling 

```
G["label"] //(or Infinity by calling G["other"]). How can I achieve this? 

```

I've found 

```
G[i].push({
    label:567856, 
    other: Infinity
})

```

but this way it adds it as a whole new element, and I'm only able to call G[4]["other"], instead of G["other"]. How can I add the element as I've described?

Thank you!

Answer: 
To add onto Andriy's answer, you need to use Javascript Objects rather than arrays. An object can have indices with custom names. For example, given

```
var newObj = {"hello": "world", "value":1, "inf": Infinity}

```

you can do

```
newObj['hello'] // "world"
newObj['value'] // 1

```

The problem with

```
G[i].push({
    label:567856, 
    other: Infinity
})

```

is that you are pushing an object with 2 attributes, not pushing 2 objects, that's why you need to use `G[4]["other"]`

See running [JSFiddle example.](https://jsfiddle.net/fc0o5583/3/)
```
G["other"] = "something";

```

With this you will keep the original array, and now have the attribute `other`, but it is not in `[12, 34, 5]`

Whit this one you can add an object to the array:

```
G.push({other: 123})
console.log(G);//[12, 34, 5, object]
console.log(G[3].other);//123

```

The problem with

```
G[i].push({
    label:567856, 
    other: Infinity
})

```

is that you are pushing an object with 2 attributes, not pushing 2 objects, that's why you need to use G[4]["other"]