Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32610 > unrolled thread

Array elements and "subarrays?" internal dependencies

Started byjonas.thornvall@gmail.com
First post2017-02-11 22:50 -0800
Last post2017-02-12 11:21 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Array elements and "subarrays?" internal dependencies jonas.thornvall@gmail.com - 2017-02-11 22:50 -0800
    Re: Array elements and "subarrays?" internal dependencies jonas.thornvall@gmail.com - 2017-02-11 23:12 -0800
    Re: Array elements and "subarrays?" internal dependencies jonas.thornvall@gmail.com - 2017-02-12 00:24 -0800
    Re: Array elements and "subarrays?" internal dependencies John Harris <niam@jghnorth.org.uk.invalid> - 2017-02-12 11:21 +0000

#32610 — Array elements and "subarrays?" internal dependencies

Fromjonas.thornvall@gmail.com
Date2017-02-11 22:50 -0800
SubjectArray elements and "subarrays?" internal dependencies
Message-ID<63222c13-59bb-4187-921e-c9c8410d2492@googlegroups.com>
arr[m] ={nodelinks : [], hold : false, rposX : 0, rposY : 0, rwidth : 10, rheigth : 10, rcolor : "red" , bcolor : "green"};
      printnode[m]=m;


I thought i would be smart to have an array with nodes and subarray? with nodelinks, directly attached upon the  array element index without using a nodeindex attribute. 

But now as i need to splice elements i rearrange the elementindex=nodeindex unwillingly without rearrange the nodelinksindexes. 

There is probably no way to deal with this other than go back to use the attribute nodeindex off array? 

Because i guess there is no smart way to let the sub indexing of nodelinks[] be dependent upon the indexing of arr[]?

Well that was not very smart of me, but thought i did save some labeling.

I must say i am a bit confused by the terminology should i refer to array above as an array or an object? And then what is nodelinks an attribute or a property of arr, or a  subarray?

Someone ones told me there is no multidimensional arrays in javascript, well it looks like one.

[toc] | [next] | [standalone]


#32612

Fromjonas.thornvall@gmail.com
Date2017-02-11 23:12 -0800
Message-ID<e9ee41db-d2b7-444d-9d37-25f3a7eb41b8@googlegroups.com>
In reply to#32610
Den söndag 12 februari 2017 kl. 07:50:06 UTC+1 skrev jonas.t...@gmail.com:
> arr[m] ={nodelinks : [], hold : false, rposX : 0, rposY : 0, rwidth : 10, rheigth : 10, rcolor : "red" , bcolor : "green"};
>       printnode[m]=m;
> 
> 
> I thought i would be smart to have an array with nodes and subarray? with nodelinks, directly attached upon the  array element index without using a nodeindex attribute. 
> 
> But now as i need to splice elements i rearrange the elementindex=nodeindex unwillingly without rearrange the nodelinksindexes. 
> 
> There is probably no way to deal with this other than go back to use the attribute nodeindex off array? 
> 
> Because i guess there is no smart way to let the sub indexing of nodelinks[] be dependent upon the indexing of arr[]?
> 
> Well that was not very smart of me, but thought i did save some labeling.
> 
> I must say i am a bit confused by the terminology should i refer to array above as an array or an object? And then what is nodelinks an attribute or a property of arr, or a  subarray?
> 
> Someone ones told me there is no multidimensional arrays in javascript, well it looks like one.

Well i could scan the whole array with subindexes and try to fix the linkings "but it do get confusing because all the forward changes and their relations to the linkings" and it seem like ***alot*** harder excersise than just throw in nodeindex again...

[toc] | [prev] | [next] | [standalone]


#32613

Fromjonas.thornvall@gmail.com
Date2017-02-12 00:24 -0800
Message-ID<dff1eb77-d748-4d6a-bc1e-7876878b34ea@googlegroups.com>
In reply to#32610
Den söndag 12 februari 2017 kl. 07:50:06 UTC+1 skrev jonas.t...@gmail.com:
> arr[m] ={nodelinks : [], hold : false, rposX : 0, rposY : 0, rwidth : 10, rheigth : 10, rcolor : "red" , bcolor : "green"};
>       printnode[m]=m;
> 
> 
> I thought i would be smart to have an array with nodes and subarray? with nodelinks, directly attached upon the  array element index without using a nodeindex attribute. 
> 
> But now as i need to splice elements i rearrange the elementindex=nodeindex unwillingly without rearrange the nodelinksindexes. 
> 
> There is probably no way to deal with this other than go back to use the attribute nodeindex off array? 
> 
> Because i guess there is no smart way to let the sub indexing of nodelinks[] be dependent upon the indexing of arr[]?
> 
> Well that was not very smart of me, but thought i did save some labeling.
> 
> I must say i am a bit confused by the terminology should i refer to array above as an array or an object? And then what is nodelinks an attribute or a property of arr, or a  subarray?
> 
> Someone ones told me there is no multidimensional arrays in javascript, well it looks like one.

Well now i am a bit confused, a full reordering of noderelationships, or make the node[indexing] unrelated to the element[indexing], a reordering only need to run once as you splice, and if you get it right have no effects on the program.

But the other one leave a gap between arr element indexing and the actual index of nodes, but i think a nodeindex only used during data printout and painting canvas, but i could be wrong. 

[toc] | [prev] | [next] | [standalone]


#32615

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2017-02-12 11:21 +0000
Message-ID<l8h0acdhcldelo0uooei7m6cekga0plenq@4ax.com>
In reply to#32610
On Sat, 11 Feb 2017 22:50:01 -0800 (PST), jonas.thornvall@gmail.com
wrote:

  <snip>
>Someone ones told me there is no multidimensional arrays in javascript, well it looks like one.

There are no multidimensional arrays that you access like this :
  a[2,9,3]

There are multidimensional arrays that you access like this :
  a[2][9][3]
but your program has to build them one dimension at a time. They're
not so smooth as in some other languages.

  John

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web