optional
Thirty JavaScript Methods - The Cheat Sheet required
METHOD TYPE PARAMETERS DEFINITION
slice() A (start, end) extracts section of an array and returns a new array
reverse() A none reverses the order of an array
join() A (separator) joins elements of an array & returns a string
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
split() S (separator, limit) splits a string into array of substrings
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
substr() (start, length) extracts parts of a string beginning at character of specified
S position, & returns the specified number of characters.
charAt() S (index) returns the character at specified index of string
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.
String() (object) converts the value of an object to a string
toString() N (radix) converts a number to a string
toFixed() N (x) converts number into string, keeping a specified number
of decimals (x)
Number() (object) converts the value of an object to a number
parseFloat() N (string) parses a string and returns a number
parseInt() N (string, radix) parses a string and returns a whole number
Math.round() N (x) returns the value of a number (x) rounded to the nearest integer
Math.ceil() N (x) returns a value (x) rounded up to its 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