JavaScript Basic Series (four) data type (array of arrays)

Source: Internet
Author: User

String, numeric, and Boolean values are discrete values (scalar), and if a variable is discrete, then it has only one value at any time.

If you want to use a variable to store a set of values, you need to use an array.

An array is a collection of tree values with the same name , and each array in the collection is an element of an array, and you can use the variable team to store the names of each member of the team.

In JavaScript, arrays are created using the keyword array declaration, and colleagues can also declare the length of a variable. For example

var New Array (12); // declaring the length of a variable

when the final number of an array is unpredictable, declaring an array can specify no specific number . For example:

var ateam = new Array ();//array final number is unknown, you can not declare the exact number
Ateam[0] = 1414;
ATEAM[1] = "Beijing";
ATEAM[2] = 0x4;
ATEAM[3] = "I can";
ATEAM[4] = "red";
ATEAM[5] = "Blue";
ATEAM[6] = "orange";

Alternatively, you can create an array directly

var New Array ("111", "Blue", "Red", "Beijing");

As with strings, arrays can also use length to get and specify the length of an array.

   var New Array ("111", "Blue", "Red", "Beijing" );    document.write (ateam[1]+ "<br>");     + "<br>")

Note: The array can be understood more deeply.

  var New Array ("111", "Blue", "Red", "Beijing" );    ateam[] = "12415"    document.write (ateam[20]+ "<br>");     + "<br>")

Not finished

JavaScript Basic Series (four) data type (array of arrays)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.