Show Menu
Cheatography

Javascript Cheat Sheet (DRAFT) by

Javascript cheat sheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

String Object Methods

Method
Descri­ption
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
 

Array Object Methods

Method
Descri­ption
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