Cheatography
https://cheatography.com
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
decodeURI() |
isNaN() |
decodeURIComponent() |
Number() |
encodeURI() |
parseFloat() |
encodeURIComponent() |
parseInt() |
escape() |
String() |
eval() |
unescape() |
isFinite() |
JavaScript Strings
charAt() |
slice() |
charCodeAt() |
split() x |
concat() |
substr() |
fromCharCode() |
substring() |
indexOf() |
toLowerCase() |
lastIndexOf() |
toUpperCase() |
length |
toLocaleLowerCase() |
localeCompare() |
toLocaleUpperCase() |
match() x |
toSource() |
replace() x |
valueOf() |
search() x |
String object methods with an x support regular expressions.
Misc
parseInt() |
Takes a value and tries to convert it to an integer |
isNaN() |
Returns true if something is not a number. |
setTimeout() |
Specify that am action should occur on a particular schedule |
Math.floor |
Rounds a number down |
Math.random |
Generaters a random number between 0 and 1 |
getElementsByTagName() |
getElementById() |
getElementsByClassName() |
element.innerHTML |
returns all the HTML between the opening and closing tags |
element.nodeType |
property, returns the number of the node type |
element.childNodes |
A node list of child nodes that are indexed numerically, and appear in source order. |
element.childNodes.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() |
NEGATIVE_INFINITY |
asin() |
PI |
atan() |
POSITIVE_INFINITY |
atan2() |
pow() |
ceil() |
random() |
cos() |
round() |
E |
sin() |
exp() |
sqrt() |
floor() |
SQRT1_2 |
LN10 |
SQRT2 |
LN2 |
tan() |
log() |
toSource() |
LOG10E |
toExponential() |
LOG2E |
toFixed() |
max() |
toPrecision() |
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 encountered an error |
onfocus |
The user made an object active |
onload |
The object finished loading |
onmouseover |
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 |
onmousedown |
A mouse button is pressed down |
onmouseup |
A mouse button is released |
onmousemove |
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() |
leftCOntext |
global |
multiline |
ignoreCase |
rightContext |
input |
source |
lastIndex |
test() |
lastMatch |
|