or   Register or Register today to make and share your own cheat sheets! (Why Join?)

Cheatography Login

Join Us!

Not a Cheatographer? Register here!

Social Media

You can login to or register with Cheatography using your Facebook or Twitter account!

Why Join Cheatography?

Make and share cheat sheets!
Join a great community of Cheatographers and add your very own contributions.

Save your favourites!
Quick access to your most loved cheat sheets.

Fewer ads!
Members see no ads on the site.

Coming soon ...
Requests, ratings and more!

Why Join Cheatography?

Make and share cheat sheets!
Join a great community of Cheatographers and add your very own contributions.

Save your favourites!
Quick access to your most loved cheat sheets.

Fewer ads!
Members see no ads on the site.

Coming soon ...
Requests, ratings and more!

JavaScript Cheat Sheet by DaveChild

1 Comment   |   Add a Comment   |   PDF Download   |   Find:

Regular Expressions Syntax

^ Start of string
$ End of string
. Any single character
(a|b) a or b
(...) Group section
[abc] In range (a, b or c)
[^abc] Not in range
\s White space
a? Zero or one of a
a* Zero or more of a
a*? Zero or more, ungreedy
a+ One or more of a
a+? One or more, ungreedy
a{3} Exactly 3 of a
a{3,} 3 or more of a
a{,6} Up to 6 of a
a{3,6} 3 to 6 of a
a{3,6}? 3 to 6 of a, ungreedy
\ Escape character
[:punct:] Any punctu­ation symbol
[:space:] Any space character
[:blank:] Space or tab

There's an excellent regular expression tester at: http:/­/re­gex­pal.com/

Pattern Modifiers

g Global match
i * Case-i­nse­nsitive
m * Multiple lines
s * Treat string as single line
x * Allow comments and whitespace in pattern
e * Evaluate replac­ement
U * Ungreedy pattern

* PCRE modifier

JavaScript RegExp Object

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

JavaScript Event Handlers

onAbort onMous­eDown
onBlur onMous­eMove
onChange onMouseOut
onClick onMous­eOver
onDblClick onMouseUp
onDragDrop onMove
onError onReset
onFocus onResize
onKeyDown onSelect
onKeyPress onSubmit
onKeyUp onUnload
onLoad

JavaScript Arrays

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

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

JavaScript Booleans

toSource() valueOf()
toString()
 

JavaScript Dates

Date() setMonth()
getDate() setFul­lYear()
getDay() setHours()
getMonth setMin­utes()
getFul­lYear setSec­onds()
getYear setMil­lis­eco­nds()
getHours setTime()
getMinutes setUTC­Date()
getSeconds setUTC­Day()
getMil­lis­econds setUTC­Month()
getTime setUTC­Ful­lYear()
getTim­ezo­neO­ffset() setUTC­Hours()
getUTC­Date() setUTC­Min­utes()
getUTC­Day() setUTC­Sec­onds()
getUTC­Month() setUTC­Mil­lis­eco­nds()
getUTC­Ful­lYear() toSource()
getUTC­Hours() toString()
getUTC­Min­utes() toGMTS­tring()
getUTC­Sec­onds() toUTCS­tring()
getUTC­Mil­lis­eco­nds() toLoca­leS­tring()
parse() UTC()
setDate() valueOf()

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.

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()

Favourited by 18 Members:

catspaw82 CITguy CyberTron SamCollett xcjjzh cjvalotta alexmail93 arnoldobr anomalophobe dimitrios lawvol brentscheidt Pufahl sting2kx jagrock powareverb Wbbourne Marty

Comments

Piotrek Piotrek, 20:16 28 Feb 12

Where's typof() ?

Add a Comment

Comment:

Contents

JavaScript methods and functions, a guide to regular expres­sions and the XMLHtt­pRe­quest object.

Column Content Comments Author Updated
- JavaScript Cheat Sheet DaveChild 29 Dec 11
1 Regular Expressions Syntax 0 DaveChild 10 Oct 11
Pattern Modifiers 0 DaveChild 29 Dec 11
JavaScript RegExp Object 0 DaveChild 10 Oct 11
2 JavaScript Event Handlers 0 DaveChild 10 Oct 11
JavaScript Arrays 0 DaveChild 10 Oct 11
JavaScript Numbers and Maths 0 DaveChild 10 Oct 11
JavaScript Booleans 0 DaveChild 10 Oct 11
3 JavaScript Dates 0 DaveChild 10 Oct 11
JavaScript Strings 0 DaveChild 10 Oct 11
JavaScript Functions 0 DaveChild 10 Oct 11