script>
Episode
The use of arrays is a technique for the program designation. Each of the clauses is displayed in a certain set. Or promise that you have declined the performance in the program design, but the files provided by Netscape are not mentioned and the array is used. This is because JavaScript does not support arrays. But now I will teach you to use the array in JavaScript. First, the array is dry? You can see it as a string of string (variables). Suppose you need to declare 10 variables now, you can declare 10 variables as A, B, C ..., but this method will become very troublesome when you need 100 or more variables. . If you use a array with 10 elements (Elements) to indicate these 10 variables, you can use MyArray [1], MyArray [2], MyArray [3] ... First, Second, 3 .... variable (many clause language is starting from 0 as the first element, but starting from 1 in the JavaScript syntax). Because you want to specify the value of the first element (or claim) to 17, you just want to write to myArray [1] = 17. This can be seen that the function of the array and the same variable are the same. Not only, if you want to specify all the elements to be 17, you only need to write a simple circle (LOOP): for (var i = 1; i <11; i ) myarray [i] = 17 for- This instruction is to tell the computer to have a total of several times. The For-loop is from 1 to 1, that is, the computer will first execute myArray [1] = 17. Then I will increase 1 and then do my marrray [2] = 17. i each time you increase until i = 10 is stopped. Next to teach you how to make an initialization of the array. This question has been discussed in JavaScript mailing list. (If you want to subscribe to Mailing List, you only need to fill in Subscribe JavaScript-Digest and send it to Majordomo @ obscure.org. Then you receive a big file from about 20-30kb every day. These files include all letters from JavaScript-List).
Function initaray () {
this.Length = INITARRAY.ARGUMENTS.LENGTH
For (var i = 0; i THIS [i 1] = INITARRAY.ARGUMENTS [i] } You don't need to solve this letter, you only have to know how to use it. If you want to declare a burst with three elements, and its value is specified as 17, 18, 19, you just want to write: var myarray = newinitaray (17, 18, 19). You can also use a string (strings) as a value of the element: var heyho = newinitay ("this", "is", "cool"). Therefore, you don't have to manage the type (TYPE) of the element value, that is, the mixed: var mixedup = newinitaray (17, "yo", 103). Next, I will initialize an array 'mixedup' and display the contents of the array: