Make new arrays from old array

A

aliensite

For NS6+ and IE5+ :
How to make arrays car[], color[] and year[]
from array data[]

var data = [
'Ford','blue','2001',
'Chevy','white','1998',
'Dodge','red','2003',
'Honda','green,'2000'
];

Thanks
 
A

aliensite

cols=3;
var car=new Array;
var color=new Array;
var year=new Array;
for(i=0,j=0;i<data.length;i+=cols,j++){
car[j]=data;
color[j]=data[i+1];
year[j]=data[i+2];
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top