In javascript, to read the array index and their appropriate value.
Use the following way,
var a = Array.new(); declare new array with name 'a'
a = [1,2,3,4,5]; assign some values to array
var indexes = function show(value, indx){
alert(indx);
alert(value);
}
a.forEach(indexes);
'forEach' method is used to collect the values from the array.
By using the method 'forEach', we can collect each element from array.
Try this..
No comments:
Post a Comment