|
An array enables you to hold an arbitrary
number of "things" without defining beforehand what
they will hold. Each piece of data contained in the array
is referred to as an element. An array is created much like
an object, using Array as the constructor, with the number
of elements that it will hold as the argument for that constructor.
Example :
Suppose you want to create an array called
Namelist that holds four different names. You can do it as:
namelist
= new Array(4);
Now you can assign values to the different elements of the array, as follows:
namelist[0] = "Vijay";
namelist[1] = "Ajay";
namelist[2] = "Rohit";
namelist[3] = "Sarathy";
The number that is used to refer to an individual
element of an array is known as its array index.
Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.
|
|