JavaScript Array Methods

You are Here:

Array Methods Demo

Add Your Company

Try the following

  1. Add empty value
  2. Add duplicate value eg) 'BMW', 'Audi', 'Ford'. (case-sensitive)
  3. Add random value eg) your name

Hints

The above demo uses the following array methods.

  • Array.indexOf() - to check for duplicate company.
  • Array.push() - to add your company to array items.

List of Array Methods

The following table provides a list of all array methods available in JavaScript.

MethodExplanation
concat()Joins two or more arrays and returns a copy of joined arrays
copyWithin()Copies a sequence of array elements within the array
entries()Returns the key/value pairs for each index in the array
every()Checks if every element in an array satisfies the given condition
fill()Fill the elements in an array with a static value
filter()Creates a new array with every elements in an array that statisfies the given condition
find()Returns the value of the first element in an array that satisfies the given condition
findIndex()Returns the index of the first element in an array that satisfies the given condition
forEach()Calls a function for each element in the array
from()Creates a new Array iterable object (string, object, etc)
includes()Check if an array contains the specified element
indexOf()Search a specified element in an array and return the first (least) index of an element, or -1 if none is found
isArray()Checks whether the given object is an array
join()Joins all elements of an array into a string
keys()Returns a new Array Iterator that contains the keys for each index in the array
lastIndexOf()Search a specified element in an array and return the last (least) index of an element, or -1 if none is found
map()Creates a new array with the results of calling a provided function on every element in this array
pop()Removes the last element from an array and returns that element
push()Adds new elements to the end of an array and returns the new length of the array
reduce()Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value
reduceRight()Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value
reverse()Reverses the order of the elements in an array
shift()Removes the first element from an array and returns that element
slice()Extracts a part of an array and returns a new array
some()Checks if any of the elements in an array satisfies the given condition
sort()Sorts the elements of an array
splice()Adds and/or removes elements from an array
toLocaleString()Returns a localized string representing the array and its elements
toString()Converts an array to a string and returns the string
unshift()Adds one or more elements to the beginning of an array and returns the new length
valueOf()Returns the primitive value of an array
values()Returns a new Array Iterator that contains the values for each index in the array

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author