for (num=0;num That those objects may be int, string, etc., is immaterial. Generally, an array is collection of similar items. for (i=0;i. var array_result=my_array.indexOf("Rohit"); The includes() method is used to check whether the given element is included in the array or not. } Array Directly The variable ‘a’ refers to a single value in memory. When you declare an array as "new object [x]", you are not "storing multiple data types", you only have objects. JavaScript Array Method document.writeln(array_result); This is very important because it means that an offset of one unit will always exist: the first element will have an index of 0, and the second element will have an index of 1, and so on. If we want to store different data types in the array, then we can create an array of type object so if I convert to this in type object then now we are able to store type integer. document.writeln(my_array); An array is used to store a collection set, but it is often more helpful to consider an array as a set of the same type of variables. The push() method is used to add the element to the end of the array. Une boucle for...in parcourt les propriétés d'un objet dans un ordre arbitraire (voir l'opérateur deletepour plus d'explications quant à l'impossibilité de se fier à un tel ordre, au moins dans le cas où on souhaite gérer plusieurs navigateurs). var my_array=["Dhoni","Sachin","Rohit","Dhawan"]; Methods of Arrays in Javascript. Declaration of an Array . JavaScript Array Method var my_array=["Dhoni","Sachin","Kohli","Rohit","Dhawan"]; As we know objects allow us to store keyed collections of values. The array is a single variable that is used to store different elements. Array with different types of data? You can have objects in an Array. You can create an array with elements of different data types when declare the array as Object. JavaScript Array Method var my_array=["England","Australia","India"]; The reverse() method is used to reverse the sequence of the given array of elements. JavaScript Array Method