- Tags: Array
- Categories: JavaScript Reference, JavaScript Resources, Reference
Quick Reference
This is a quick reference list of JavaScript array methods and properties with examples of how they are used.
JavaScript – Array concat() Method
The Array concat() method joins two or more arrays, returning a new array containing the joined arrays, without changing the existing arrays.
JavaScript – Array constructor Property
The Array constructor property returns the function that created the Array prototype.
JavaScript – Array copyWithin() Method
The Array copyWithin() method copies array elements to another position in an array, overwriting the existing values.
JavaScript – Array entries() Method
The Array entries() method returns an array iterator object that shows the key and value pairs currently existing within the array.
JavaScript – Array every() Method
The Array every() method executes a function for each array element, returning true if the function returns true or false.
JavaScript – Array fill() Method
The Array fill() method fills specified elements in an array with a value, overwriting the original array.
JavaScript – Array filter() Method
The filter() method creates a new array filled with elements that pass a test provided by a function, leaving the existing array unchanged.
JavaScript – Array find() Method
The Array find() method executes a function for each array element and returns the value of the first element that passes a test.
JavaScript – Array findIndex() Method
The Array findIndex() method executes a function for each array element, and returns the index (position) of the first element that passes a test.
JavaScript – Array forEach() Method
The Array forEach() method calls a function, running it for each item in an array.
JavaScript – Array.from() Method
The Array.from() method returns an array from any object with a length property.
JavaScript – Array includes() Method
The Array includes() method returns true if an array contains a specified value, and returns false if the value is not found.
JavaScript – Array indexOf() Method
The Array indexOf() method returns the first index position of a specified value, and returns -1 if the value is not found in the array.
JavaScript – Array.isArray() Method
The Array.isArray() method tests an object to determine if it’s an array. It returns true if an object is an array and false if the object is not.
JavaScript – Array length Property
The Array length property sets or returns the number of elements in an array.
JavaScript – Array join() Method
The Array join() method returns an array as a string leaving the original array unchanged.
JavaScript – Array map() Method
The Array map() method creates a new array by calling a function for every array item.
JavaScript – Array keys() Method
The Array keys() method returns an array iterator object containing the keys of a specified array.
JavaScript – Array pop() Method
The Array pop() method removes and returns the last element of an array, changing the original array.
JavaScript – Array lastIndexOf() Method
The lastIndexOf() method returns the last position of a specified value, searching from right to left, returning -1 if the value is not found.
JavaScript – Array.prototype Property
The Array.prototype property allows new properties and methods to be added to existing arrays.
JavaScript – Array push() Method
The Array push() method adds new items to the end of an array, changing the length of the array.
JavaScript – Array reduce() Method
The reduce() method executes a reducer function for every array item, returning a single value representing the function’s accumulated result.
JavaScript – Array reduceRight() Method
The Array reduceRight() method executes a reducer function for every array item, working from right to left, returning a single value.
JavaScript – Array reverse() Method
The Array reverse() method reverses the order of the items in an array, overwriting the original array.
JavaScript – Array shift() Method
The Array shift() method removes and returns the first element of an array, changing the original array.
JavaScript – Array slice() Method
The Array slice() method returns selected elements in an array as a new array, without changing the original array.
JavaScript – Array some() Method
The Array some() method checks if any array elements pass a test by executing a callback function for each array element.
JavaScript – Array sort() Method
The Array sort() method sorts the elements of an array as strings in alphabetical and ascending order, overwriting the original array.
JavaScript – Array splice() Method
The Array splice() method adds and/or removes array elements, overwriting the original array.
JavaScript – Array toString() Method
The Array toString() method returns a string with array values separated by commas, and does not change the original array.
JavaScript – Array unshift() Method
The Array unshift() method adds new elements to the beginning of an array, overwriting the original array.
JavaScript – Array valueOf() Method
The Array valueOf() method returns the value of the array (contents), and does not change the original array.
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.
Why 1SMARTchicken?
See More →
Thanks for your support!
JavaScript Books
All are affiliate links. Thank you for your support!
JAVASCRIPT NOTES:
- When using JavaScript, single or double quotation marks are acceptable and work identically to one another; choose whichever you prefer, and stay consistent
- JavaScript is a case-sensitive language; firstName is NOT the same as firstname
- Arrays count starting from zero NOT one; so item 1 is position [0], item 2 is position [1], and item 3 is position [2] … and so on
- JavaScript variables must begin with a letter, $, or _
- JavaScript variables are case sensitive (x is not the same as X)
Feedback
If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.