Thirty Javascript Methods - The Cheat Sheet: Type Parameters Method
Thirty Javascript Methods - The Cheat Sheet: Type Parameters Method
slice() A (start, end) extracts section of an array and returns a new array
shift() A none removes first element of array, and returns that element
unshift() A (element1, element2.......) adds new items to the front of array, and returns new length
pop() A none removes last element of array, and returns that element
push() A (element1, element2.......) adds new items to the end of array, and returns new length
forEach() A function(element, index, arr) executes function once for each array element (returns nothing)
filter() A function(element, index, arr) creates a new array that contains all the values for which the
callback function returns true
map() function(element, index, arr) executes function once for each array element (returns a new,
A transformed array)
reduce() A function(acc, element, index, executes a function for each value of the array, from left to right,
arr), initialValue and reduces the array to a single value
reduceRight() function(acc, element, index, executes a function for each value of the array, from right to left,
A arr), initialValue and reduces the array to a single value
slice() S (start, end) extracts section of a string and returns it as a new string
non-inclusive
substring() S (start, end) the same as slice(), but can't accept negative values
indexOf() (searchvalue, startingIndex) returns the position of the first occurrence of a specified value
S in a string.
lastIndexOf() (searchvalue, startingIndex) returns the position of the last occurrence of a specified value
S in a string.
Math.round() N (x) returns the value of a number (x) rounded to the nearest integer
Math.floor() N (x) returns a value (x) rounded down to its nearest integer
Math.min() N (num1, num2, num3,......) returns the number with the lower value
Math.max() N (num1, num2, num3,......) returns the number with the highest value