javascript array grid

Do you have to write out your information for a multi-dimensional array in javascript? i.e.: var array = [ ["1", "2"],
["3", "4"],
Or can you form an array (var arr = ["1", "2"]) and then assign it to the first index of another array.

var cells = new Array();
cells[0] = arr;

There seems to be a bug in my code and I'm wondering if it was my array creation. Thanks
August 4,
var cells = new Array();

is exactly the same as

var cells = [];
Alex (ActiveWidgets)
August 8,
I tried this:

var cells = new Array();
var arr = ["1", "2"]
cells[0] = arr;

It was right

If your code has a bug, I'm sure these lines have nothing to do with it.

But I noticed that your code use "cells" "arr" as variable names, they are too normal, it seems to me that you may use them in other lines or as names of Document Objs, if you do so , it will be a bug.

Best wishes
August 16,
thanks for the help
August 16,

This topic is archived.

See also:

Back to support forum