Some Array Methods

var newArray= Array.from(oldArray);

var newArray = oldArray.slice(); 

Makes a new copy of the old array instead of just referencing it.


Array.isArray(input); 

Checks if a value is an array.


arr.slice(begin, end);

Extracts a portion of an array based on provided indices. (Omitting begin will default it to index 0.  Omitting end will default to extracting up to the end arr.length).


arr.splice(startIndex, deleteCount, ‘item1‘, item2‘, etc.);

Remove or insert element where start is.  (Set deleteCount to 0 if you’re inserting).

Advertisements
Some Array Methods

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s