JavaScript Cheat Sheet
JavaScript often abbreviated as “JS”, is a high-level, dynamic, untyped, interpreted run-time language.It has been standardized in the ECMAScript language specification. Alongside HTML and CSS, JavaScript is one of the three core technologies of World Wide Web content production.
Cheat Sheet for JavaScript:
ExpresÂsions 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
|
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()
|
JavaScript Arrays
|
concat()
|
slice()
|
|
join()
|
sort()
|
|
length
|
splice()
|
|
pop()
|
toSource()
|
|
push()
|
toString()
|
|
reverse()
|
unshift()
|
|
shift()
|
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()
|
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()
|
JavaScript Booleans
|
toSource()
|
valueOf()
|
|
toString()
|
|
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()
|
JavaScript RegExp Object
|
compile()
|
lastParen
|
|
exec()
|
leftCOÂntext
|
|
global
|
multiline
|
|
ignoreCase
|
rightCÂontext
|
|
input
|
source
|
|
lastIndex
|
test()
|
Incrementing /decrementing numbers
| Increment | ++x or x++ |
| Decrement | –x or x– |
The difference is that ++x (–x) returns the incremented (decremented) value, while x++(x–) returns the previous value of x.
