- #1
aheight
- 321
- 109
Hi,
I'm writing an HTML/Javascript application that will handle a large amount of data segregated into a set of n rings, each ring will have a set of m branches, and each branch will have four arrays of data, V, N, I, B. I would like to create a 3-D array to hold this data but am having problems setting it up. Does Javascript even handle 3D arrays?
Ideally, I would like to address for example the second ring, branch 3, data set 4 as something like
data[2][3][4].
But when I attempt to set up a simple example like below, I receive the NetBean error:
Uncaught TypeError: Cannot read property '3' of undefined
I would like to save all the data to a .js file with the following format. Can someone help me set this up?
var data[[[]]];
data[0][0][0]=[v1,v2,v3,...vn];
data[0][0][1]=[n1,n2,n3,...nn];
data[0][0][2]=[i1,i2,i3,... in];
data[0][0][3]=[b1,b2,b3,...bn];
...
data[n][m][4]=[b1,b2,b3,...bn];
I'm writing an HTML/Javascript application that will handle a large amount of data segregated into a set of n rings, each ring will have a set of m branches, and each branch will have four arrays of data, V, N, I, B. I would like to create a 3-D array to hold this data but am having problems setting it up. Does Javascript even handle 3D arrays?
Ideally, I would like to address for example the second ring, branch 3, data set 4 as something like
data[2][3][4].
But when I attempt to set up a simple example like below, I receive the NetBean error:
Uncaught TypeError: Cannot read property '3' of undefined
I would like to save all the data to a .js file with the following format. Can someone help me set this up?
var data[[[]]];
data[0][0][0]=[v1,v2,v3,...vn];
data[0][0][1]=[n1,n2,n3,...nn];
data[0][0][2]=[i1,i2,i3,... in];
data[0][0][3]=[b1,b2,b3,...bn];
...
data[n][m][4]=[b1,b2,b3,...bn];
HTML:
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>TODO write content</div>
<script type="text/javascript">
var data=[[[]]];
data[2][3][4]=24;
alert(data[2][3][4]);
</script>
</body>
</html>