Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
This type of an array is similar to parallel arrays. In a multidimensional array, instead of creating two or more arrays in tandem as we did with the parallel array, we create an array with several levels or "dimensions." Remember our example of a spreadsheet with rows and columns? This time, however, we have a couple more columns.
var emailList = new Array();
Next, we create arrays for elements of the main array:
emailList = new Array("President", "Paul Smith", "email@example.com"); emailList = new Array("Vice President", "Laura Stevens", "firstname.lastname@example.org"); emailList = new Array("General Manager", "Mary Larsen", "email@example.com"); emailList = new Array("Sales Manager", "Bob Lark", "firstname.lastname@example.org");
In this script we created "sub arrays" or arrays from another level or "dimension." We used the name of the main array and gave it an index number (e.g.,
emailList). Then we created a new instance of an array and gave it a value with three elements.
In order to access a single element, we need to use a double reference. For example, to get the e-mail address for the Vice President in our example above, access the third element "
" of the second element "
" of the array named
It would be written like this:
var vpEmail = emailList alert("The address is: "+ vpEmail)
You could also retrieve the information using something like:
var title = emailList var email = emailList alert("The e-mail address for the " + title +" is: " + email)
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...