You are on page 1of 2

JavaScript Cheat Sheet

by Dave Child (DaveChild) via cheatography.com/1/cs/7/


Regular Expressions Syntax ^ $ . (a|b) (...) [abc] [^abc] \s a? a* a*? a+ a+? a{3} a{3,} a{,6} a{3,6} a{3,6}? \ [:punct:] [:space:] [:blank:] Start of string End of string Any single character a or b Group section In range (a, b or c) Not in range White space Zero or one of a Zero or more of a Zero or more, ungreedy One or more of a One or more, ungreedy Exactly 3 of a 3 or more of a Up to 6 of a 3 to 6 of a 3 to 6 of a, ungreedy Escape character Any punctuation symbol Any space character Space or tab JavaScript Arrays concat() join() length pop() push() reverse() shift() slice() sort() splice() toSource() toString() unshift() valueOf() JavaScript Event Handlers onAbort onBlur onChange onClick onDblClick onDragDrop onError onFocus onKeyDown onKeyPress onKeyUp onLoad onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onMove onReset onResize onSelect onSubmit onUnload JavaScript Dates Date() getDate() getDay() getMonth getFullYear getYear getHours getMinutes getSeconds getMilliseconds getTime getTimezoneOffset() getUTCDate() getUTCDay() getUTCMonth() getUTCFullYear() getUTCHours() getUTCMinutes() getUTCSeconds() getUTCMilliseconds() parse() setDate() JavaScript Strings charAt() charCodeAt() concat() fromCharCode() indexOf() lastIndexOf() length localeCompare() match() x replace() x search() x String object methods with an x support regular expressions. JavaScript Functions decodeURI() decodeURIComponent() encodeURI() encodeURIComponent() JavaScript Booleans toSource() toString() valueOf() escape() eval() isFinite() Sponsor Envoy, for simple and effective bug management. isNaN() Number() parseFloat() parseInt() String() unescape() slice() split() x substr() substring() toLowerCase() toUpperCase() toLocaleLowerCase() toLocaleUpperCase() toSource() valueOf() setMonth() setFullYear() setHours() setMinutes() setSeconds() setMilliseconds() setTime() setUTCDate() setUTCDay() setUTCMonth() setUTCFullYear() setUTCHours() setUTCMinutes() setUTCSeconds() setUTCMilliseconds() toSource() toString() toGMTString() toUTCString() toLocaleString() UTC() valueOf()

JavaScript Numbers and Maths abs() acos() min() NEGATIVE_INFINITY PI POSITIVE_INFINITY pow() random() round() sin() sqrt() SQRT1_2 SQRT2 tan() toSource() toExponential() toFixed() toPrecision() toString() valueOf()

There's an excellent regular expression tester at: http://regexpal.com/ Pattern Modifiers g i* m* s* x* e* U* Global match Case-insensitive Multiple lines Treat string as single line Allow comments and whitespace in pattern Evaluate replacement Ungreedy pattern

asin() atan() atan2() ceil() cos() E exp() floor() LN10 LN2

* PCRE modifier JavaScript RegExp Object compile() exec() global ignoreCase input lastIndex lastMatch lastParen leftCOntext multiline rightContext source test()

log() LOG10E LOG2E max() MAX_VALUE MIN_VALUE NaN

Cheatographer Dave Child (DaveChild)

Cheat Sheet This cheat sheet was published on 19th October,

cheatography.com/davechild/ www.addedbytes.com

2011 and was last updated on 29th December, 2011.

Try it free! http://www.envoyapp.com

You might also like