Note that there are some explanatory texts on larger screens.

plurals
  1. POGet the place of element in big Array[x][y][z] javascript
    primarykey
    data
    text
    <p>I sitting on it more then hour, may be because of late hour or may be i just stupid but i cant do it. I have two arrays</p> <pre><code>a[0] = [['','',''],['','',''],['','','']]; a[1] = [['','',''],['','',''],['','','']]; a[2] = [['','',''],['','',''],['','','']]; a[3] = [['','',''],['','',''],['','','']]; b=['','','','', '','','','','', '','','','','', '','','','','', '','','','','', '','','','','', '','','','','', '',''] </code></pre> <p>As you see it is different formats of array, but each cell from array a[] refers to the his brother in array b[]</p> <p>i'm trying to write a function that get the adreess of cell in array a[] like that calculate(3,2,2) and return the adress of cell in array b[]</p> <p>Here is what i wrote so far...</p> <pre><code>function timecalculating(x,y,z) { var count =z; var prew=y-1; for (var i=k; i&gt;-1; i--) { for (var j=vocabulary[i].length; j&gt;-1; j--) { count+=vocabulary[i][prew].length; } } alert (count) ; } </code></pre> <p>But i know it is not right.. Any suggestions??</p> <p>Here is some examples: INPUT (3,1,1) which means</p> <pre><code>a[0] = [['','',''],['','',''],['','','']]; a[1] = [['','',''],['','',''],['','','']]; a[2] = [['','',''],['','',''],['','','']]; a[3] = [['','',''],['','HERE',''],['','','']]; </code></pre> <p>So it shold count all of it down. (2+3)+(3+3+3)+(3+3+3)+(3+3+3)=32 &lt;= this is "adress" in array b[] 2 - is z 3(first) is a[x][y].length 3(second) is a[x][y-1].length</p> <p>and so on..</p> <p>i want it to be universal for arrays with different lengthes)</p> <pre><code>a[0] = [['','',''],['','',''],['','','']]; a[1] = [['',''],['','','']]; a[2] = [['','',''],[''],['','']]; a[3] = [['','','']]; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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