[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Still trouble with array of arrays.

JT

1/23/2016 10:25:00 PM

for(i = 0; i < operandArr.length; i ++ )
{
metaOpArr[i] = operandArr[i].split("").map(Number).reverse();
}

If operandArr=[12,5,28] will not metaOpAr[8] contain 2,1 and be an array in itself?
2 Answers

JT

1/23/2016 10:49:00 PM

0

Den lördag 23 januari 2016 kl. 23:25:50 UTC+1 skrev jonas.t...@gmail.com:
> for(i = 0; i < operandArr.length; i ++ )
> {
> metaOpArr[i] = operandArr[i].split("").map(Number).reverse();
> }
>
> If operandArr=[12,5,28] will not metaOpAr[8] contain 2,1 and be an array in itself?

metaOpArr[0] contain 2,1 and be an array in itself?

Stefan Weiss

1/23/2016 10:52:00 PM

0

On 01/23/2016 23:49, jonas.thornvall@gmail.com wrote:
> Den lördag 23 januari 2016 kl. 23:25:50 UTC+1 skrev jonas.t...@gmail.com:
>> for(i = 0; i < operandArr.length; i ++ )
>> {
>> metaOpArr[i] = operandArr[i].split("").map(Number).reverse();
>> }
>>
>> If operandArr=[12,5,28] will not metaOpAr[8] contain 2,1 and be an array in itself?
>
> metaOpArr[0] contain 2,1 and be an array in itself?

No, because numbers don't have a split() method. If operandArr is ["12",
"5", "28"] instead, then metaOpArr[0] is indeed the array [2, 1].

I don't know it that's good or bad, because you forgot to tell us what
your trouble with arrays is, and what you want the code to do.

- stefan