map(>
This method creates a new array with the consequences of calling a provided function on every element in this array.
filter(>
This javascript array filter method creates a new array with only elements that passes the condition inside the provided function.
sort(>
Used to arrange elements in ascending or descending order.
forEach(>
assists with loops over array by executing a provided callback function for each element in an array.
concat(>
Used to join to two or more array and give new array without changing existing array data.
every(>
Checks every element of an array that passes a given condition and return true or false.
some(>
Checks atleast one element of an array that passes a given condition and return true or false.
includes(>
Checks if an array includes the element of an array that passes a given condition and return true or false.
join(>
javascript join returns another(new>
string by concatenating each of the array's elements seprated by the specified separator.
reduce(>
The javascript reduce Applies a function against an accumulator and every element in the array to reduce it to a single value.
find(>
Returns the value of the first component in an array that pass the test in a testing function.
findIndex(>
Returns the index of the first component in an array that pass the test in a testing function.
IndexOf(>
Returns the index of the first occurance of specified element of an array else return -1 if not found.
fill(>
This method fills the components in an array with a static value and returns the altered array.
slice(>
The javascript slice Returns a new array with given start and given end.
reverse(>
Reverses the array.javascript Last element of array will be the first element of new array.
push(>
Adds one or more elements to end of array and new return length of array.
pop(>
Removes last element of an array and returns that element.
shift(>
Removes first element of an array and returns that element.
unshift(>
Javascriot unshift Adds one or more elements to start of an array and return new length of array.
splice(>
The javascript splice Adds or remove the array elements
alert(>
The javascript alert used to display the virtual alert box
split(>
The javascript split a string into an array of substring.
parseInt(>
The javascript parseInt parse a value as a string and return first integer or javascript to int.
The javascript queryselector (>
retuens single element but javascript queryselectorall (>
access all element which match with a specific css selector
Let's see an javascript program example
<html>
<head>
<title>Arrays!!!</title>
<script type="text/javascript">
var students = new Array("Jonny", "Annabel", "Edwin">
;
Array.prototype.displayItems=function(>
{
for (i=0;i
{ document.write(this[i]="" +="" "
">
;
}
}
document.write("students array
">
;
students.displayItems(>
;
document.write("
The number of items in students array is " + students.length + "
">
;
document.write("
The SORTED students array
">
;
students.sort(>
;
students.displayItems(>
;
document.write("
The REVERSED students array
">
;
students.reverse(>
;
students.displayItems(>
;
document.write("
THE students array after REMOVING the LAST item
">
;
students.pop(>
;
students.displayItems(>
;
document.write("
THE students array after PUSH
">
;
students.push("New Stuff">
;
students.displayItems(>
;
</script>
</head>
<body>
</body>
</html>
{>
Output
Try it here