| New Reply |
A question in javascript |
Share Thread |
| Sep10-12, 07:20 AM | #1 |
|
|
A question in javascript
The general form for creating an array is:
Myarray=new arrayname(); But I don't understand wht should I type in the name of the array twice? Because I thought Myarray and arrayname is the same. |
| Sep10-12, 07:51 AM | #2 |
|
|
DO you really mean something like this:
MyArray myArray = new MyArray(); where MyArray is a class and myArray is an instance? The statement above creates an instance called myArray of type MyArray. This is how you initialize myArray rather like assigning a value to it. MyArray myArray1; MyArray myArray2; MyArray myArray3; you can't use myArray1, myArray2, or myArray3 until you've assigned them a value that is until you do this: myArray1 = new MyArray(); myArray2 = new MyArray(); myArray3 = new MyArray(); hope this helps. |
| New Reply |
Similar discussions for: A question in javascript
|
||||
| Thread | Forum | Replies | ||
| Javascript calculator | Calculators | 1 | ||
| HTML + Javascript + CSS | Programming & Comp Sci | 11 | ||
| write a javascript bookmark | Programming & Comp Sci | 2 | ||
| Javascript Help | Programming & Comp Sci | 4 | ||