An element in an array can be accessed by referring to the name of the array, followed by open braces [inside which the index number of the element to be accessed is placed and then the braces are closed using].
if a programmer wants to write the element “Institute” define in the array exforsys below.
It is written as follows:
var Exforsys=new Array( )
will write Institute as output.
It is also possible that the value or elements of the array defined can be edited or modified.
This is written using the same approach for accessing array elements.
if a programmer wants to change the value of “Division” to “Output” it can simply be written as follows:
General format for defining the literal array is as follows:
For example, if a programmer wants to define an array named exforsys with the first element “Example”, the second and third elements of the array as undefined and the fourth element as “Training”, it can be written as follows:
var Exforsys=[“Example”, , , “Training”]
Thus, using this method, the programmer has the flexibility to leave elements undefined between the arrays.