# Pushing To Array adds an ID to the object?

**URL:** <https://discourse.processing.org/t/pushing-to-array-adds-an-id-to-the-object/11037>\
**Category:** Libraries\
**Created:** [May 8, 2019, 3:55pm UTC](https://discourse.processing.org/t/pushing-to-array-adds-an-id-to-the-object/11037 "2019-05-08T15:55:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![peachman](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peachman](https://discourse.processing.org/u/peachman)\
**Post date:** [May 8, 2019, 3:55pm UTC](https://discourse.processing.org/t/pushing-to-array-adds-an-id-to-the-object/11037/1 "2019-05-08T15:55:06Z")

</div>

HI,

Confusing one here, really not sure whats happening.

As you can see below, i am only creating a from entry and a to entry in the object.

```auto
var edgesToLoad = [];
  for (var j = 0; j < dataArr.length; j++) {
    edge = {
      from: dataArr[j][1],
      to: dataArr[j][0]
    }
    edgesToLoad.push(edge);
  }
  
  print(edgesToLoad);

```

However on the output there is an ID with some random hash looking value?

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2efb1e3a26ae19d9e5166dc9226b22ebf238ca54.png)

Does anyone know why this is happening? or is there a way i can prevent this from happening?

EDIT Doesnt effect my how it works, still curious about why this happens?

Thanks

Peachman.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 8, 2019, 4:20pm UTC](https://discourse.processing.org/t/pushing-to-array-adds-an-id-to-the-object/11037/2 "2019-05-08T16:20:37Z")

</div>

AFAIK, that extra property _id_ shouldn’t exist! 😵  
Unless that was added to Object’s _prototype_ somehow: 👾

> **[Object.prototype](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype)**
>
> The Object.prototype is a property of the Object constructor. And it is also the end of a prototype chain.

  
By any chance, are you using some library that perhaps modifies the Object’s _prototype_? 📚  
You should host your sketch online so we can check it out ourselves. ✔

---

<div class="post-metadata">

**Author:** ![peachman](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peachman](https://discourse.processing.org/u/peachman)\
**Post date:** [May 8, 2019, 9:27pm UTC](https://discourse.processing.org/t/pushing-to-array-adds-an-id-to-the-object/11037/3 "2019-05-08T21:27:24Z")

</div>

Hi,

I’m using vis.js as the library as well as p5.js  
I’ve only just started working with other libraries as I’ve only just come to terms with how they can be implemented.

I don’t believe this library effects the prototype object for arrays? However I’ve not dug deep into it

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 8, 2019, 9:41pm UTC](https://discourse.processing.org/t/pushing-to-array-adds-an-id-to-the-object/11037/4 "2019-05-08T21:41:38Z")

</div>

> [@peachman](#):
>
> I don’t believe this library effects the prototype object for arrays?

- Your variable _edge{}_ is an Object, not an Array.
- However, adding properties to the Object’s _prototype{}_ would also affect Array, b/c Array is a subclass of Object.
- Actually, almost anything in JS would be affected by changes to the Object’s _prototype{}_.

> [@peachman](#):
>
> I’m using vis.js as the library as well as p5.js.

- In order to check whether a library is modifying the Object’s _prototype{}_, you can create an empty Object and **print()** it, like this: `print({});` or `console.log({});`
- If you spot anything other than ` __proto__ : Object`, something is messing w/ the Object’s _prototype{}_.
- Try that out w/ a loaded & initialized “vis.js” and w/o it.
