๐Array
๐ง under construction
JS โฉ value โฉ objectโฉ built-in โฉ Array
array
is iterable
is not associated array.
inherits methods from Array.prototype, most of these methods are generic, they work correctly for any "array-like" object.
โ๏ธ array object properties vs. array elements
thery are separateโ
array's traversal and mutation operations cannot be applied to these named properties.
setting / accessing via anything other than nonnegative integers๏ผ
will not set / retrieve an array element
will set / access one of the array's object properties.
deleting an array element leaves a โholeโ in the array and does not change the arrayโs lengthโ (sparse array)
If an array literal contains multiple commas in a row, with no value between, the array is sparse.
๐ธelement
๐ธelement index
๐ฐ creating arrays
๐ขarray literal
๐ฐ accessing elements
๐ฐ iterating elements
๐ฐ extending Array
other topics
๐ array-like - object that has indexes and length.
๐ sparse array - array that has "holes" in it.
๐ฐ accessing elements
push() - append element.
pop() - remove and return last element.
unshift() - prepend element.
shift() - remove and return first element.
combine elements
join - ้ฃๆฅๆๆๅ ็ด ใๅไฝตๆไธๅๅญไธฒใ
reduce((result, element, index, array) => {...}) -
reduceRight - reduce array from highest index to lowest. (from right to left)
find & search elements
Array is iterable.
bracket notation [] is used to access element.
JavaScript: The Definitive Guide > Ch. 7 Arrays
Guides โฉ Arrays โญ๏ธ
( ๐ง to be removed ... )
matrix methods (instance):
mat.transpose() - see matrix in "columns"
mat.maxElementInEachColumn() - for number matrices only.
How to get first N number of elements from an array
Last updated