• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/18

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

18 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
join()
The string conversions of all array elements are joined into one string. Accepts seperators.

string = array.join(separator)
var a = [1, 2, 3];

var b = a.join();
// returns "1,2,3"

var b = a.join(' + ');
// returns "1 + 2 + 3"
length()
Returns the number of values in the array. Allows for truncating and extending. Starts at 0 index.

array.length
var a = [1, 2, 3, 4, 5];

a.length
// returns 4
pop()
Removes the last element from an array and returns that value to the caller.

array.pop()
var a = [1, 2, 3, 4];

var pop = a.pop();
// returns 4
// a becomes [1, 2, 3]
push()
Appends values to an array. Accepts unlimited parameters.

array.push(element1, ..., elementN)
var a = [1, 2];

a.push(3, 4);
// a becomes [1,2,3,4]
reverse()
The reverse method reverse the elements of an array, mutating the array, and returning a reference.

array.reverse()
var a = [1, 2, 3];

a.reverse();
// returns [3, 2, 1]
shift()
Removes the (first) element at the zeroeth index and shifts the values at consecutive indexes down, then returns the removed value.

array.shift()
var a = [1, 2, 3, 4, 5]

a.shift();
// returns 1
// a becomes [2,3,4,5]
unshift()
Inserts the given values to the beginning of an array. Returns the new length of the array. Accepts unlimited parameters.

array.unshift(element1, ..., elementN)
var a = [1, 2, 3];

a.unshift(0);
// returns 4
// a becomes [0, 1, 2, 3]
slice()
Does not alter the original array, but returns an array of elements sliced from the original array leaving the original alone.

array.slice(begin, end)
var a = [1, 2, 3, 4, 5];

var b = a.slice(1, 3);
// returns [2, 3]
splice()
Removes elements and inserts elements in it's place. If a different amount, the array will have a different length. Returns removed elements.

array.splice(index , howMany[, element1[, ...[, elementN]]])
var a = [1, 2, 3, 4, 5];

var b = a.splice(1, 2, 'a', 'b', 'c')
// b is assigned [2, 3]
// a becomes [1, 'a', 'b', 'c', 4, 5]
concat()
Creates a new array consisting of the elements in the this object on which it is called. followed (in order) by the elements of that argument.

array.concat(value1, value2, ..., valueN)
var a = [1, 2, 3];
var b = ['a', 'b', 'c'];

var ab = a.concat(b);
// creates array [1, 2, 3, 'a', 'b', 'c'];
indexOf()
Compares an element to elements of the array using strict equality. if greater than the array's length it will return -1;

array.indexOf(searchElement[, fromIndex])
var a = [1, 2, 3];

var b = a.indexOf(0);
// b is assigned 1

var b = a.indexOf(7);
// b is assigned -1
sort()
Sorts in lexicographic (1, 2, 3) order unless function is supplied, the array elements are sorted according to the return value of the compare function. If a and b are two elements being compared, then:

array.sort([compareFunction])
var a = [1, 3, 2, 4, 5];

function compare(a, b) {
return b - a;
}

a.sort()
// returns [1,2,3,4,5]

a.sort(compare)
// return [5,4,3,2,1]
map()
Provides a callback function once for each element in an array, in order, and constructs a new array from the results. Only works on indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.

array.map(callback[, thisArg])
var a = [1, 3, 2, 4];

var b = a.map(function (x) {
return x.toString()
});
// b is assigned ['1', '2', '3', '4']
lastIndexOf()
lastIndexOf compares searchElement to elements of the Array using strict equality.

Search array from the end. Defaults to the array's length. If the index is greater than or equal to the length of the array, the whole array will be searched. If negative, it is taken as the offset from the end of the array.

array.lastIndexOf(searchElement[, fromIndex])
var a = [1, 3, 2, 4, 2];

var b = a.lastIndexOf(2);
// b is 4

b = a.lastIndexOf(2, 3);
//b is 2
toString()
Joins the array and returns one string containing each array element separated by commas.

array.toString()
var a = [1, 2, 3, 4];

var b = a.toString();
// b is assigned "1,2,3,4"
filter()
filter calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a true value. callback is invoked with three arguments: (value, index, array)

array.filter(callback[, thisObject])
var a = [1, 2, 3, 4, 5, 6];

a.filter(function(value, index) {
return value > 3;
});
//returns [4, 5, 6]
every()
array.every(callback[, thisObject])
some()
array.some(callback[, thisObject])