["apples", "oranges", "bananas"]
They are use to store a list of values that are the same type. Array collections hold various kinds, including strings, numbers, and objects. The values stored in an array display are accessed by their index number, starting at 0.
An array is a container with multiple values in a single variable. The values stored inside an array display of any type, including other exhibitions. Collections of an array are fixed and cannot change once created.
The most common methods that you will be using with an array are the ones. That get or set values from it. These include the indexOf() and lastIndexOf() methods. Which lets you find the index of a particular item in an array. The slice() method enables you to extract a collection section.
Some properties let information about an array without affecting its contents. These include the length property, which tells you how many items. In an array collection join() method, there is one that concatenates. All elements in an array into a string separated by commas.
var familly = ; //no familly :( var familly = new Array() // uncommon var familly = [Talel, Wafa, Eline, True, 4]; console.log(familly) //Talel familly + "<3" + familly //Talel <3 Wafa familly = "Amir"; //New coming member in the family
The first function we will discuss is “sort.” The function sorts an array alphabetically. Its values return a new collection with those sorted values. We can also use this function to sort an array by passing a parameter numerically. That specifies which type of sorting we want.
- Sort – Sorts the array in ascending or descending order
- Filter – Filters out items from a variety of collection-specific criteria
- Reduce – Reduces the collection to display value by iterating
var arr = ["a", "b", "c"];
var myArray = new Array(); // creates an empty array myArray = ["item1", "item2"]; // creates an array with two items
var myArray = new Array();
The ECMAScript standard defines how to implement a scripting language in various environments. Including web browsers and servers and explaining how to handle different data types. Such as strings, numbers, and Booleans.