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: 
```
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"]
Arrays isn't designed to suit your case.

See Array element accessing flow from [ECMAScript 262, 5.1 15.4](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4)

> 
> Array objects give special treatment to a certain class of property
>  names. A property name P (in the form of a String value) is an array
>  index if and only if ToString([ToUint32](http://www.ecma-international.org/ecma-262/5.1/#sec-9.6)(P)) is equal to P and
>  ToUint32(P) is not equal to 2^32−1.
> 
> 
> 

So you simply cannot access Array element by alphabetical name because that key won't be parsed to integer by **ToUint32**.

You can add [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) to array and store it's index after pushing into array ( [Array.prototype.push](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/push) would return you size of your array):

```
var G = [1,3,4];
var labelIndex = G.push({'label': 123}) - 1;
console.log(G[labelIndex]["label"]);

```

Actually that's solution would suite case when you have two or more objects inside your array with same property.

**Suggestion below not recommended!**

However, you can use code below to define your `G` Array properties, but it's not value of property of item from your array, it's array property:

```
G.other = Infinity;
G.label = 567856;
// Access newly created properties
console.log(G["other"]);
console.log(G["label"]);

```

**Good Luck !**