Show Menu
Cheatography

JavaScript Compilation Cheat Sheet (DRAFT) by

A basic cheat sheet for JavaScript compilation

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

JavaScript Functions

decode­URI()
isNaN()
decode­URI­Com­pon­ent()
Number()
encode­URI()
parseF­loat()
encode­URI­Com­pon­ent()
parseInt()
escape()
String()
eval()
unescape()
isFinite()

JavaScript Strings

charAt()
slice()
charCo­deAt()
split() x
concat()
substr()
fromCh­arC­ode()
substr­ing()
indexOf()
toLowe­rCase()
lastIn­dexOf()
toUppe­rCase()
length
toLoca­leL­owe­rCase()
locale­Com­pare()
toLoca­leU­ppe­rCase()
match() x
toSource()
replace() x
valueOf()
search() x
String object methods with an x support regular expres­sions.

Misc

parseInt()
Takes a value and tries to convert it to an integer
isNaN()
Returns true if something is not a number.
setTim­eout()
Specify that am action should occur on a particular schedule
Math.floor
Rounds a number down
Math.r­andom
Generaters a random number between 0 and 1
getEle­men­tsB­yTa­gName()
getEle­men­tById()
getEle­men­tsB­yCl­ass­Name()
elemen­t.i­nne­rHTML
returns all the HTML between the opening and closing tags
elemen­t.n­odeType
property, returns the number of the node type
elemen­t.c­hil­dNodes
A node list of child nodes that are indexed numeri­cally, and appear in source order.
elemen­t.c­hil­dNo­des.length
Returns the number of child nodes of the element
 

JavaScript Arrays

concat()
slice()
join()
sort()
length
splice()
pop()
toSource()
push()
toString()
reverse()
unshift()
shift()
valueOf()

Adding to an array

.length property
Adds one value to the end of an array
push()
Adds one or more items to the end of an array
unshift()
Adds one or more items to the beginning of an array.

Remove item from an array

pop()
Removes the last item from the array
shift()
Removes the first item from the array

JavaScript Numbers and Maths

abs()
min()
acos()
NEGATI­VE_­INF­INITY
asin()
PI
atan()
POSITI­VE_­INF­INITY
atan2()
pow()
ceil()
random()
cos()
round()
E
sin()
exp()
sqrt()
floor()
SQRT1_2
LN10
SQRT2
LN2
tan()
log()
toSource()
LOG10E
toExpo­nen­tial()
LOG2E
toFixed()
max()
toPrec­ision()
MAX_VALUE
toString()
MIN_VALUE
valueOf()
NaN
 

Event Handlers

onabort
The user aborted loading the page
onblur
The user left the object
onchange
The user changed the object
onclick
The user clicked an object
onerror
The script encoun­tered an error
onfocus
The user made an object active
onload
The object finished loading
onmous­eover
The cursor moved over an object
onmouseout
The cursor moved off an object
onselect
The user selected the contents of an object
onsubmit
The user submitted a form
onunload
The user left the page
onmove
The window is moved
onmous­edown
A mouse button is pressed down
onmouseup
A mouse button is released
onmous­emove
The mouse moves
ondblclick
A double click of a mouse button
onclick
A single click (down and then up) of a mouse button
onreset
A reset button is clicked on a form
onkeydown
Triggered when a key is pressed down
onkeyup
Triggered when a key is released
onkeypress
Triggered when a key is pressed and then released

JavaScript RegExp Object

compile()
lastParen
exec()
leftCO­ntext
global
multiline
ignoreCase
rightC­ontext
input
source
lastIndex
test()
lastMatch