JavaScript Arrays
Ordered lists of any type. Zero-indexed.
Methods
| Method | Action |
|---|---|
push() | Add to end |
pop() | Remove from end |
map() | Transform |
filter() | Subset |
reduce() | Aggregate |
includes() | Check exists |
join() | To string |
Ordered lists of any type. Zero-indexed.
| Method | Action |
|---|---|
push() | Add to end |
pop() | Remove from end |
map() | Transform |
filter() | Subset |
reduce() | Aggregate |
includes() | Check exists |
join() | To string |
const nums=[1,2,3,4,5];
nums.push(6);
const doubled=nums.map(n=>n*2);
const evens=nums.filter(n=>n%2===0);
const sum=nums.reduce((a,n)=>a+n,0);
More in JavaScript