hunterInt hunterInt - 5 months ago 19
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?


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