Javascript Object Methods Cheat Sheet: by Via
Javascript Object Methods Cheat Sheet: by Via
String Object Methods Math Object Methods Array Object Methods (cont)
Method Description Method Description join() joins all elements of an array into a
string
charAt() returns the character at the abs(x) returns the absolute value of x
specified index lastIndex search the array for an element,
round(x) rounds x to the nearest integer
Of() starting at the end, and returns its
concat() joins two or more strings, and
ceil(x) returns x, upwards to the nearest
position
returns a copy of the joined strings
integer
pop() removes the last element of an
indexOf() returns the position of the first
floor(x) returns x, rounded downwards to
array, and returns that element
found occurence of a specified
the nearest integer
value in a string push() adds new elements to the end of
exp(x) returns the value of Ex
an array, and returns the new
lastIndex returns the position of the last
log(x) returns the narural logarithm (base length
Of() found occurence of a specified
value in a string E) of x reverse() reverses the order of the elements
max(x, y, returns the number with the highest in an array
replace() searches for a match between a
substring (or regex) and a string, z, ...) value shift() removes the first element of an
and replaces the matched substring min(x, y, returns the number with the lowest array, and returns that element
with a new substring z, ...) value sort() sorts the elements of an array
search() searches for a match between a pow(x, returns the value of x to the power toString() converts an array to a string, and
regex and a string, and returns the y) of y (x y) returns the result
position of the match
sqrt(x) returns the square root of x valueOf() returns the primitive value of an
slice() extracts a part of a string and array
random() returns a random number between
returns a new string
0 and 1
split() splits a string into an array of Number Object Methods
sin(x) returns the sine of x (x in radians)
substrings
cos(x) returns the cosine of x (x in radians) Method Description
substr() extracts the characters from a
string, beginning at a specified tan(x) returns the tangent of an x toExponen converts a number into an
tial(x) exponential notation
start position, and through the
specified number of character Date Object Methods toFixed(x) formats a number with x numbers
of digits after the decimal point
substring extracts the characters from a Method Meaning Units
() string, between two specified toPrecisio formats a number to x length
getFullYear() 4-digit year 2000, 2001, ...
indices n(x)
getMonth() month no. 0 - 11
toLowerC converts a string to lowercase toString() converts a Number object to a
ase() letters getDate() dat of month 0 - 31 string
toUpperC converts a string to uppercase getHours() hour no. 0 - 23 valueOf() returns the primitive value of a
ase() letters getMinutes() minute no. 0 - 59 Number object