multi-dimensional array mystery - javascript (solved but may be of interest)
Try the below script, it works as it should adding 'hello' to each
element of the array in turn.
Until it reaches element [2][0].
then it throws an 'object expected' error..*sighs deeply* am i
missing something blatantly obvious here can someone please
enlighten me?
Code:
<html>
<head>
</head>
<script>
var board_pos = new Array(new Array(), new Array());
for(a = 0; a <= 5; a++)
{
for(b = 0; b <= 6; b++)
{
alert (a + ' , ' + b);
board_pos[a][b] = 'hello';
}
}
</script>
<body>
</body>
</html>