You are on page 1of 1

JavaScript Object Methods Cheat Sheet

by anas_95 via cheatography.com/27935/cs/8209/

String Object Methods Math Object Methods Array Object Methods (cont)

Method Desc​rip​tion Method Desc​rip​tion 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 lastIn​dex 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
lastIn​dex 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 Desc​rip​tion
substr() extracts the characters from a
string, beginning at a specified tan(x) returns the tangent of an x toExpo​nen​ converts a number into an
tial(x) expone​ntial 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
substr​ing extracts the characters from a Method Mean​ing Units
() string, between two specified toPrec​isi​o formats a number to x length
getFul​lYear() 4-digit year 2000, 2001, ...
indices n(x)
getMonth() month no. 0 - 11
toLowe​rC converts a string to lowercase toString() converts a Number object to a
ase() letters getDate() dat of month 0 - 31 string

toUppe​rC converts a string to uppercase getHours() hour no. 0 - 23 valueOf() returns the primitive value of a
ase() letters getMin​utes() minute no. 0 - 59 Number object

trim() removes whitespace from both getSec​onds() second no. 0 - 59


ends of a string

valueOf() returns the primitive value of a Array Object Methods


String object
Method Desc​rip​tion
toString() returns the value of a String object
concat() joins two or more arrays, and
returns a copy of the joined array

indexOf() search the array for an element


and returns its position

By anas_95 Published 15th May, 2016. Sponsored by Readability-Score.com


cheatography.com/anas-95/ Last updated 15th May, 2016. Measure your website readability!
Page 1 of 1. https://readability-score.com

You might also like