Show Menu

JavaScript Object Methods Cheat Sheet by

Provide a descriptive of methods in JavaScript object.
javascript     math     date     array     string     object     method     number

String Object Methods

Method
Desc­rip­tion
charAt()
returns the character at the specified index
concat()
joins two or more strings, and returns a copy of the joined strings
indexOf()
returns the position of the first found occurence of a specified value in a string
lastIn­dexOf()
returns the position of the last found occurence of a specified value in a string
replace()
searches for a match between a substring (or regex) and a string, and replaces the matched substring with a new substring
search()
searches for a match between a regex and a string, and returns the position of the match
slice()
extracts a part of a string and returns a new string
split()
splits a string into an array of substrings
substr()
extracts the characters from a string, beginning at a specified start position, and through the specified number of character
substr­ing()
extracts the characters from a string, between two specified indices
toLowe­rCase()
converts a string to lowercase letters
toUppe­rCase()
converts a string to uppercase letters
trim()
removes whitespace from both ends of a string
valueOf()
returns the primitive value of a String object
toString()
returns the value of a String object
 

Math Object Methods

Method
Desc­rip­tion
abs(x)
returns the absolute value of x
round(x)
rounds x to the nearest integer
ceil(x)
returns x, upwards to the nearest integer
floor(x)
returns x, rounded downwards to the nearest integer
exp(x)
returns the value of Ex
log(x)
returns the narural logarithm (base E) of x
max(x, y, z, ...)
returns the number with the highest value
min(x, y, z, ...)
returns the number with the lowest value
pow(x, y)
returns the value of x to the power of y (xy)
sqrt(x)
returns the square root of x
random()
returns a random number between 0 and 1
sin(x)
returns the sine of x (x in radians)
cos(x)
returns the cosine of x (x in radians)
tan(x)
returns the tangent of an x

Date Object Methods

Method
Mean­ing
Units
getFul­lYear()
4-digit year
2000, 2001, ...
getMonth()
month no.
0 - 11
getDate()
dat of month
0 - 31
getHours()
hour no.
0 - 23
getMin­utes()
minute no.
0 - 59
getSec­onds()
second no.
0 - 59
 

Array Object Methods

Method
Desc­rip­tion
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
join()
joins all elements of an array into a string
lastIn­dexOf()
search the array for an element, starting at the end, and returns its position
pop()
removes the last element of an array, and returns that element
push()
adds new elements to the end of an array, and returns the new length
reverse()
reverses the order of the elements in an array
shift()
removes the first element of an array, and returns that element
sort()
sorts the elements of an array
toString()
converts an array to a string, and returns the result
valueOf()
returns the primitive value of an array

Number Object Methods

Method
Desc­rip­tion
toExpo­nen­tial(x)
converts a number into an expone­ntial notation
toFixed(x)
formats a number with x numbers of digits after the decimal point
toPrec­isi­on(x)
formats a number to x length
toString()
converts a Number object to a string
valueOf()
returns the primitive value of a Number object

Download the JavaScript Object Methods Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/anas-95_javascript-object-methods.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          AngularJS Cheat Sheet
          JavaScript Cheat Sheet
          JavaScript Array API Cheat Sheet