Vous êtes sur la page 1sur 2

JavaScript Cheat Sheet

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

Regular Expres​sions Syntax Pattern Modifiers (cont) JavaScript Arrays

^ Start of string x* Allow comments and whitespace in concat() slice()

$ End of string pattern join() sort()

. Any single character e* Evaluate replac​ement length splice()

(a|b) a or b U* Ungreedy pattern pop() toSource()

(...) Group section * PCRE modifier push() toString()

[abc] In range (a, b or c) reverse() unshift()


JavaScript RegExp Object
[^abc] Not in range shift() valueOf()
compile() lastParen
\s White space
exec() leftCO​ntext JavaScript Numbers and Maths
a? Zero or one of a
global multiline abs() min()
a* Zero or more of a
ignoreCase rightC​ontext acos() NEGATI​VE_​INF​INITY
a*? Zero or more, ungreedy
input source asin() PI
a+ One or more of a
lastIndex test() atan() POSITI​VE_​INF​INITY
a+? One or more, ungreedy
lastMatch atan2() pow()
a{3} Exactly 3 of a

a{3,} 3 or more of a ceil() random()


JavaScript Event Handlers
a{,6} Up to 6 of a cos() round()
onabort onmous​edown
a{3,6} 3 to 6 of a E sin()
onblur onmous​emove
a{3,6}? 3 to 6 of a, ungreedy exp() sqrt()
onchange onmouseout
\ Escape character floor() SQRT1_2
onclick onmous​eover
[:punct:] Any punctu​ation symbol LN10 SQRT2
ondblclick onmouseup
[:space:] Any space character LN2 tan()
ondragdrop onmove
[:blank:] Space or tab log() toSource()
onerror onreset
LOG10E toExpo​nen​tial()
There's an excellent regular expression tester
onfocus onresize
at: http:/​/re​gex​pal.com/ LOG2E toFixed()
onkeydown onselect
max() toPrec​ision()
Pattern Modifiers onkeypress onsubmit
MAX_VALUE toString()
g Global match onkeyup onunload
MIN_VALUE valueOf()
i* Case-i​nse​nsitive onload
NaN
m* Multiple lines

s* Treat string as single line

By Dave Child (DaveChild) Published 19th October, 2011. Sponsored by Readability-Score.com


cheatography.com/davechild/ Last updated 22nd April, 2015. Measure your website readability!
www.addedbytes.com Page 1 of 2. https://readability-score.com
JavaScript Cheat Sheet
by Dave Child (DaveChild) via cheatography.com/1/cs/7/

JavaScript Booleans JavaScript Strings

toSource() valueOf() charAt() slice()

toString() charCo​deAt() split() x

concat() substr()
JavaScript Dates
fromCh​arC​ode() substr​ing()
Date() setMonth() indexOf() toLowe​rCase()
getDate() setFul​lYear() lastIn​dexOf() toUppe​rCase()
getDay() setHours() length toLoca​leL​owe​rCase()
getMonth setMin​utes() locale​Com​pare() toLoca​leU​ppe​rCase()
getFul​lYear setSec​onds() match() x toSource()
getYear setMil​lis​eco​nds() replace() x valueOf()
getHours setTime() search() x
getMinutes setUTC​Date()
String object methods with an x support regular
getSeconds setUTC​Day() expres​sions.
getMil​lis​econds setUTC​Month()
JavaScript Functions
getTime setUTC​Ful​lYear()

getTim​ezo​neO​ffset() setUTC​Hours() decode​URI() isNaN()

getUTC​Date() setUTC​Min​utes() decode​URI​Com​pon​ent() Number()

getUTC​Day() setUTC​Sec​onds() encode​URI() parseF​loat()

getUTC​Month() setUTC​Mil​lis​eco​nds() encode​URI​Com​pon​ent() parseInt()

getUTC​Ful​lYear() toSource() escape() String()

getUTC​Hours() toString() eval() unescape()

getUTC​Min​utes() toGMTS​tring() isFinite()

getUTC​Sec​onds() toUTCS​tring()

getUTC​Mil​lis​eco​nds() toLoca​leS​tring()

parse() UTC()

setDate() valueOf()

By Dave Child (DaveChild) Published 19th October, 2011. Sponsored by Readability-Score.com


cheatography.com/davechild/ Last updated 22nd April, 2015. Measure your website readability!
www.addedbytes.com Page 2 of 2. https://readability-score.com

Vous aimerez peut-être aussi