Page 1 of 1

Syntax for a multi-dimensional array?

Posted: February 20th, 2011, 1:53 pm
by herbie
I know the syntax for a 1 dimensional array..
var myArray = new Array();

But what is the syntax for a 2 or 3 dimensional array?


Also.. what is the syntax for making a number into a string?
say for example,

alert(myArray[0] (as String)); ...or something like that...

Re: Syntax for a multi-dimensional array?

Posted: March 3rd, 2011, 12:05 pm
by lloydalvarez
But what is the syntax for a 2 or 3 dimensional array?
If you mean an array that holds arrays you could define it like this:

Code: Select all

var myArray = [new Array(),new Array()];
Although in most cases you don't need to do that you can just define the array directly with the values:

Code: Select all

var myArray = [[0,0],[1,1]];
Also.. what is the syntax for making a number into a string

Code: Select all

var myNum = 100;
var myStr = myNum.toString();
AE scripting is based on javascript so you can google these questions using the javascript keyword and you'll find that there's tons and tons of resources out there.

-Lloyd