Link to home
Start Free TrialLog in
Avatar of kiqkinas
kiqkinasFlag for United States of America

asked on

3D Javascript Array

I'm trying to declair a 3d Array but my syntax is wrong. Please help.
var prod_data = new Array("Helvetica", 
new Array(
	new Array("BL10102","2","2","1 5/8","1/2","6.20"),
	new Array("BL10103","3","3","2 1/4","1/2","6.40"),
	new Array("BL10103","4","3","3-7/8","1/2","7.40")
),
new Array(
	new Array("Times Bold",
	new Array("BL10204","4","3","3-7/8","1/2","7.40"),
	new Array("BL10206","6","4","5-3/4","3/4","9.80"),
	new Array("BL10208","8","5","5-3/4","7-5/8","12.40")
	)
);
 
alert(prod_data[0][0][0]); //Helvetica
alert(prod_data[0][1][0]); //BL10102
alert(prod_data[0][1][1]); //2
alert(prod_data[1][0][0]); //Times Bold

Open in new window

Avatar of ruscomp
ruscomp
Flag of United States of America image

So it should be something along these lines:

var prod_data = ["Helvetica",
["BL10102","2","2","1 5/8","1/2","6.20")],
["BL10103","3","3","2 1/4","1/2","6.40"],
["BL10103","4","3","3-7/8","1/2","7.40"]
],
["Times Bold",
["BL10204","4","3","3-7/8","1/2","7.40"],
["BL10206","6","4","5-3/4","3/4","9.80"],
["BL10208","8","5","5-3/4","7-5/8","12.40"]
]
ASKER CERTIFIED SOLUTION
Avatar of ruscomp
ruscomp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kiqkinas

ASKER

Perfect! Thank you.