Note that there are some explanatory texts on larger screens.

plurals
  1. POBest practice for writing ARRAYS
    primarykey
    data
    text
    <p>I've got an array with about 250 entries in it, each their own array of values. Each entry is a point on a map, and each array holds info for: </p> <p>name, another array for points this point can connect to, latitude, longitude, short for of name, a boolean, and another boolean</p> <p>The array has been written by another developer in my team, and he has written it as such:</p> <pre><code>names[0]=new Array; names[0][0]="Campus Ice Centre"; names[0][1]= new Array(0,1,2); names[0][2]=43.95081811364498; names[0][3]=-78.89848709106445; names[0][4]="CIC"; names[0][5]=false; names[0][6]=false; names[1]=new Array; names[1][0]="Shagwell's"; names[1][1]= new Array(0,1); names[1][2]=43.95090307839151; names[1][3]=-78.89815986156464; names[1][4]="shg"; names[1][5]=false; names[1][6]=false; </code></pre> <p>Where I would probably have personally written it like this:</p> <pre><code> var names = [] names[0] = new Array("Campus Ice Centre", new Array[0,1,2], 43.95081811364498, -78.89848709106445, "CIC", false, false); names[1] = new Array("Shagwell's", new Array[0,1], 43.95090307839151, -78.89815986156464, 'shg", false, false); </code></pre> <p>They both work perfectly fine of course, but what I'm wondering is:</p> <p>1) does one take longer than the other to actually process? 2) am I incorrect in assuming there is a benefit to the compactness of my version of the same thing?</p> <p>I'm just a little worried about his 3000 lines of code versus my 3-400 to get the same result.</p> <p>Thanks in advance for any guidance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload