Avatar of kiqkinas
kiqkinas
Flag 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

JavaScript

Avatar of undefined
Last Comment
kiqkinas

8/22/2022 - Mon
ruscomp

ruscomp

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
ruscomp

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
kiqkinas

ASKER
Perfect! Thank you.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes