Jump to content

JavaScript 2D array


zero_point

Recommended Posts

Hi all, how can I create 2D array ... like this .... var array = [][] ... you know what I mean ... like in other languages ... is it possible?

Edited by zero_point
Link to comment
Share on other sites

You have to decide the length of the array before hand and then create arrays as elements of the parent one.

var a = [];a[0] = [];a[1] = [];a[2] = [];a[3] = [];a[4] = [];
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...