by @kodeazy

javascript How to access elements in an array?

Home » javascript » javascript How to access elements in an array?
  • Array holds multiple values of data of similar type.
  • we can access elemnts of array through index number
  • Below is an example of accessing elements of array.

    var arry = ['element_1', 'element_2', 'element_3', 'element_4', 'element_5','element_6'];
    for(var i=0;i<arry.length;i++){
    console.log(i);
    }

    Output:

    element_1
    element_2
    element_3
    element_4
    element_5
    element_6