hunterInt hunterInt - 1 year ago 87
Javascript Question

javascript access multidimensional object not working

I have an object:

var Obj = [{
id: "",
position: {
cartesian: [],
polar: [],

When I go to set"sam/reconnaissance - "+samName;

It works fine.

However when I go to access Obj.position.cartesian


I get this error:

TypeError: Cannot read property 'cartesian' of undefined

Why? I have tried
and still nothing

What am I doing wrong?

Answer Source

Obj is not an object, it is an Array so you have to access first element with index 0. Try it like

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download