Basic Objects

Array Properties

constructor Returns the function that created the Array object's prototype
length Sets or returns the number of elements in an array
prototype Allows you to add properties and methods to an Array object

Array Methods

concat() Joins two or more arrays, and returns a copy of the joined arrays
indexOf() Search the array for an element and returns its position
join() Joins all elements of an array into a string
lastIndexOf() Search the array for an element, starting at the end, and returns its position
pop() Removes the last element of an array, and returns that element
push() Adds new elements to the end of an array, and returns the new length
reverse() Reverses the order of the elements in an array
shift() Removes the first element of an array, and returns that element
slice() Selects a part of an array, and returns the new array
sort() Sorts the elements of an array
splice() Adds/Removes elements from an array
toString() Converts an array to a string, and returns the result
unshift() Adds new elements to the beginning of an array, and returns the new length
valueOf() Returns the primitive value of an array

Boolean Properties

constructor Returns the function that created the Boolean object's prototype
prototype Allows you to add properties and methods to a Boolean object

Boolean Methods

toString() Converts a Boolean value to a string, and returns the result
valueOf() Returns the primitive value of a Boolean object

Math Properties

E Returns Euler's number (approx. 2.718)
LN2 Returns the natural logarithm of 2 (approx. 0.693)
LN10 Returns the natural logarithm of 10 (approx. 2.302)
LOG2E Returns the base-2 logarithm of E (approx. 1.442)
LOG10E Returns the base-10 logarithm of E (approx. 0.434)
PI Returns PI (approx. 3.14)
SQRT1_2 Returns the square root of 1/2 (approx. 0.707)
SQRT2 Returns the square root of 2 (approx. 1.414)

Math Methods

abs(x) Returns the absolute value of x
acos(x) Returns the arccosine of x, in radians
asin(x) Returns the arcsine of x, in radians
atan(x) Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians
atan2(y,x) Returns the arctangent of the quotient of its arguments
ceil(x) Returns x, rounded upwards to the nearest integer
cos(x) Returns the cosine of x (x is in radians)
exp(x) Returns the value of Ex
floor(x) Returns x, rounded downwards to the nearest integer
log(x) Returns the natural logarithm (base E) of x
max(x,y,z,...,n) Returns the number with the highest value
min(x,y,z,...,n) Returns the number with the lowest value
pow(x,y) Returns the value of x to the power of y
random() Returns a random number between 0 and 1
round(x) Rounds x to the nearest integer
sin(x) Returns the sine of x (x is in radians)
sqrt(x) Returns the square root of x
tan(x) Returns the tangent of an angle

Number Properties

constructor Returns the function that created the Number object's prototype
MAX_VALUE Returns the largest number possible in JavaScript
MIN_VALUE Returns the smallest number possible in JavaScript
NEGATIVE_INFINITY Represents negative infinity (returned on overflow)
POSITIVE_INFINITY Represents infinity (returned on overflow)
prototype Allows you to add properties and methods to an object

Number Methods

toExponential(x) Converts a number into an exponential notation
toFixed(x) Formats a number with x numbers of digits after the decimal point
toPrecision(x) Formats a number to x length
toString() Converts a Number object to a string
valueOf() Returns the primitive value of a Number object

String Properties

constructor Returns the function that created the String object's prototype
length Returns the length of a string
prototype Allows you to add properties and methods to an object

String Methods

charAt() Returns the character at the specified index
charCodeAt() Returns the Unicode of the character at the specified index
concat() Joins two or more strings, and returns a copy of the joined strings
fromCharCode() Converts Unicode values to characters
indexOf() Returns the position of the first found occurrence of a specified value in a string
lastIndexOf() Returns the position of the last found occurrence of a specified value in a string
match() Searches for a match between a regular expression and a string, and returns the matches
replace() Searches for a match between a substring (or regular expression) and a string, and replaces the matched substring with a new substring
search() Searches for a match between a regular expression and a string, and returns the position of the match
slice() Extracts a part of a string and returns a new string
split() Splits a string into an array of substrings
substr() Extracts the characters from a string, beginning at a specified start position, and through the specified number of characters
substring() Extracts the characters from a string, between two specified indices
toLowerCase() Converts a string to lowercase letters
toUpperCase() Converts a string to uppercase letters
valueOf() Returns the primitive value of a String object

String HTML Wrapper Methods

anchor() Creates an anchor
big() Displays a string using a big font
blink() Displays a blinking string
bold() Displays a string in bold
fixed() Displays a string using a fixed-pitch font
fontcolor() Displays a string using a specified color
fontsize() Displays a string using a specified size
italics() Displays a string in italic
link() Displays a string as a hyperlink
small() Displays a string using a small font
strike() Displays a string with a strikethrough
sub() Displays a string as subscript text
sup() Displays a string as superscript text

Global Properties

Infinity A numeric value that represents positive/negative infinity
NaN Not-a-Number value
undefined Indicates that a variable has not been assigned a value

Global Methods

decodeURI() Decodes a URI
decodeURIComponent() Decodes a URI component
encodeURI() Encodes a URI
encodeURIComponent() Encodes a URI component
escape() Encodes a string
eval() Evaluates a string and executes it as if it was script code
isFinite() Determines whether a value is a finite, legal number
isNaN() Determines whether a value is an illegal number
Number() Converts an object's value to a number
parseFloat() Parses a string and returns a floating point number
parseInt() Parses a string and returns an integer
String() Converts an object's value to a string
unescape() Decodes an encoded string

Date Object

Date Properties

constructor Returns the function that created the Date object's prototype
prototype Allows you to add properties and methods to an object

Date Methods

getDate() Returns the day of the month (from 1-31)
getDay() Returns the day of the week (from 0-6)
getFullYear() Returns the year (four digits)
getHours() Returns the hour (from 0-23)
getMilliseconds() Returns the milliseconds (from 0-999)
getMinutes() Returns the minutes (from 0-59)
getMonth() Returns the month (from 0-11)
getSeconds() Returns the seconds (from 0-59)
getTime() Returns the number of milliseconds since midnight Jan 1, 1970
getTimezoneOffset() Returns the time difference between GMT and local time, in minutes
getUTCDate() Returns the day of the month, according to universal time (from 1-31)
getUTCDay() Returns the day of the week, according to universal time (from 0-6)
getUTCFullYear() Returns the year, according to universal time (four digits)
getUTCHours() Returns the hour, according to universal time (from 0-23)
getUTCMilliseconds() Returns the milliseconds, according to universal time (from 0-999)
getUTCMinutes() Returns the minutes, according to universal time (from 0-59)
getUTCMonth() Returns the month, according to universal time (from 0-11)
getUTCSeconds() Returns the seconds, according to universal time (from 0-59)
parse() Parses a date string and returns the number of milliseconds since midnight of January 1, 1970
setDate() Sets the day of the month of a date object
setFullYear() Sets the year (four digits) of a date object
setHours() Sets the hour of a date object
setMilliseconds() Sets the milliseconds of a date object
setMinutes() Set the minutes of a date object
setMonth() Sets the month of a date object
setSeconds() Sets the seconds of a date object
setTime() Sets a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970
setUTCDate() Sets the day of the month of a date object, according to universal time
setUTCFullYear() Sets the year of a date object, according to universal time (four digits)
setUTCHours() Sets the hour of a date object, according to universal time
setUTCMilliseconds() Sets the milliseconds of a date object, according to universal time
setUTCMinutes() Set the minutes of a date object, according to universal time
setUTCMonth() Sets the month of a date object, according to universal time
setUTCSeconds() Set the seconds of a date object, according to universal time
toDateString() Converts the date portion of a Date object into a readable string
toISOString() Returns the date as a string, using the ISO standard
toJSON() Returns the date as a string, formatted as a JSON date
toLocaleDateString() Returns the date portion of a Date object as a string, using locale conventions
toLocaleTimeString() Returns the time portion of a Date object as a string, using locale conventions
toLocaleString() Converts a Date object to a string, using locale conventions
toString() Converts a Date object to a string
toTimeString() Converts the time portion of a Date object to a string
toUTCString() Converts a Date object to a string, according to universal time
UTC() Returns the number of milliseconds in a date string since midnight of January 1, 1970, according to universal time
valueOf() Returns the primitive value of a Date object

DOM Events

Mouse Events

click The event occurs when the user clicks on an element
dblclick The event occurs when the user double-clicks on an element
mousedown The event occurs when a user presses a mouse button over an element
mousemove The event occurs when a user moves the mouse pointer over an element
mouseover The event occurs when a user mouse over an element
mouseout The event occurs when a user moves the mouse pointer out of an element
mouseup The event occurs when a user releases a mouse button over an element

Keyboard Events

keydown The event occurs when the user is pressing a key or holding down a key
keypress The event occurs when the user is pressing a key or holding down a key
keyup The event occurs when a keyboard key is released

Frame Events

abort The event occurs when an image is stopped from loading before completely loaded (for <object>)
error The event occurs when an image does not load properly
load The event occurs when a document, frameset, or <object> has been loaded
resize The event occurs when a document view is resized
scroll The event occurs when a document view is scrolled
unload The event occurs when a document is removed from a window or frame (for <body> and <frameset>)

Form Events

blur The event occurs when a form element loses focus
change The event occurs when the content of a form element, the selection, or the checked state have changed (for <input>, <select>, and <textarea>)
focus The event occurs when an element gets focus (for <label>, <input>, <select>, textarea>, and <button>)
reset onreset
select The event occurs when a user selects some text (for <input> and <textarea>)
submit The event occurs when a form is submitted

Event Object Constants

AT_TARGET The current event is in the target phase, i.e. it is being evaluated at the event target (1)
BUBBLING_PHASE The current event phase is the bubbling phase (2)
CAPTURING_PHASE The current event phase is the capture phase (3)

Event Object Properties

bubbles Returns whether or not an event is a bubbling event
cancelable Returns whether or not an event can have its default action prevented
currentTarget Returns the element whose event listeners triggered the event
eventPhase Returns which phase of the event flow is currently being evaluated
target Returns the element that triggered the event
timeStamp Returns the time (in milliseconds relative to the epoch) at which the event was created
type Returns the name of the event

Event Object Methods

initEvent() Specifies the event type, whether or not the event can bubble, whether or not the event's default action can be prevented
preventDefault() To cancel the event if it is cancelable, meaning that any default action normally taken by the implementation as a result of the event will not occur
stopPropagation() To prevent further propagation of an event during event flow

EventTarget Object

addEventListener() Allows the registration of event listeners on the event target (IE8 = attachEvent())
dispatchEvent() Allows to send the event to the subscribed event listeners (IE8 = fireEvent())
removeEventListener() Allows the removal of event listeners on the event target (IE8 = detachEvent())

EventListener Object

handleEvent() Called whenever an event occurs of the event type for which the EventListener interface was registered

MouseEvent/KeyboardEvent Object

altKey Returns whether or not the "ALT" key was pressed when an event was triggered
button Returns which mouse button was clicked when an event was triggered
clientX Returns the horizontal coordinate of the mouse pointer, relative to the current window, when an event was triggered
clientY Returns the vertical coordinate of the mouse pointer, relative to the current window, when an event was triggered
ctrlKey Returns whether or not the "CTRL" key was pressed when an event was triggered
keyIdentifier Returns the identifier of a key
keyLocation Returns the location of the key on the advice
metaKey Returns whether or not the "meta" key was pressed when an event was triggered
relatedTarget Returns the element related to the element that triggered the event
screenX Returns the horizontal coordinate of the mouse pointer, relative to the screen, when an event was triggered
screenY Returns the vertical coordinate of the mouse pointer, relative to the screen, when an event was triggered
shiftKey Returns whether or not the "SHIFT" key was pressed when an event was triggered

MouseEvent/KeyboardEvent Methods

initMouseEvent() Initializes the value of a MouseEvent object
initKeyboardEvent() Initializes the value of a KeyboardEvent object

Core DOM

Nodelist Properties

length Returns the number of nodes in the collection

Nodelist Methods

item() Returns the node at the specified index in a node list

NamedNodeMap Properties

length Returns the number of nodes in the collection

NamedNodeMap Methods

getNamedItem() Returns the specified node (by name)
getNamedItemNS() Returns the specified node (by name and namespace)
item() Returns the node at the specified index in the namedNodeMap
removeNamedItem() Removes the specified node (by name)
removeNamedItemNS() Removes the specified node (by name and namespace)
setNamedItem() Sets the specified node (by name)
setNamedItemNS() Sets the specified node (by name and namespace)

Document Properties

doctype Returns the Document Type Declaration associated with the document
documentElement Returns the Document Element of the document (the HTML element)
documentURI Sets or returns the location of the document
domConfig Returns the configuration used when normalizeDocument() is invoked
implementation Returns the DOMImplementation object that handles this document
inputEncoding Returns the encoding, character set, used for the document
xmlEncoding Returns the XML encoding of the XML document
xmlVersion Sets or returns the XML version of the XML document

Document Methods

adoptNode(node) Adopts a node from another document to this document. Returns the adopted node
createAttribute() Creates an attribute node
createAttributeNS(URI, name) Creates an attribute with the specified name and namespace
createCDATASection() Creates a CDATA node with the specified text. For XML DOM only
createComment() Creates a Comment node with the specified text
createDocumentFragment() Creates an empty DocumentFragment node
createElement() Creates an Element node
createElementNS() Creates an element with the specified namespace
createEntityReference() Creates an EntityReference node. For XML DOM only
createProcessingInstruction() Creates an EntityReference node. For XML DOM only
createTextNode() Creates a Text node
getElementById() Returns the element that has the ID attribute with the specified value
getElementsByTagName() Returns a NodeList containing all elements with the specified tagname
getElementsByName() Returns a list of elements with a given name in the (X)HTML document.
querySelectorAll() Returns a NodeList containing all elements that match the specified CSS selector
querySelector() Returns the first element matching the specified CSS selector
getElementsByTagNameNS() Returns a NodeList containing all elements with the specified namespaceURI and tagname
importNode() Imports a node from another document
normalizeDocument() Removes empty Text nodes, and joins adjacent nodes

Element Properties

schemaTypeInfo Returns the type information of the element.
tagName Returns the tag name of the element

Element Methods

getAttribute() Returns the specified attribute value
getAttributeNS() Returns the specified attribute value, with the specified namespace. For XML DOM only
getAttributeNode() Returns the specified attribute node
getAttributeNodeNS() Returns the specified attribute node, with the specified namespace. For XML DOM only
getElementsByTagName() Returns a collection of all child elements with the specified tagname
getElementsByTagNameNS() Returns a collection of all child elements with the specified tagname and namespace. For XML DOM only
hasAttribute() Returns true if the element has the specified attribute, otherwise it returns false
hasAttributeNS() Returns true if the element has the specified attribute, with the specified namespace, otherwise it returns false. For XML DOM only
removeAttribute() Removes the specified attribute
removeAttributeNS() Removes the attribute with the specified name and namespace. For XML DOM only
removeAttributeNode() Removes the specified attribute node, and returns the removed node
setAttribute() Sets or changes the specified attribute, to the specified value
setAttributeNS() Sets or changes the specified attribute, with the specified namespace, to the specified value. For XML DOM only
setAttributeNode() Sets or changes the specified attribute node
setAttributeNodeNS() Sets or changes the specified attribute node
setIdAttribute() setIdAttribute()
setIdAttributeNS() setIdAttributeNS()
setIdAttributeNode() setIdAttributeNode()

Attr Properties

isId Returns
name Returns the name of the attribute
ownerElement Returns the element this attribute belongs to
schemaTypeInfo Returns the type information of the attribute
specified Returns
value Sets or returns the value of the attribute

Window Object

Window Properties

closed Returns a Boolean value indicating whether a window has been closed or not
defaultStatus Sets or returns the default text in the statusbar of a window
document Returns the Document object for the window
frames Returns an array of all the frames (including iframes) in the current window
history Returns the History object for the window
innerHeight Sets or returns the inner height of a window's content area
innerWidth Sets or returns the inner width of a window's content area
length Returns the number of frames (including iframes) in a window
location Returns the Location object for the window
name Sets or returns the name of a window
navigator Returns the Navigator object for the window
opener Returns a reference to the window that created the window
outerHeight Sets or returns the outer height of a window, including toolbars/scrollbars
outerWidth Sets or returns the outer width of a window, including toolbars/scrollbars
pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parent Returns the parent window of the current window
screen Returns the Screen object for the window
screenLeft Returns the x coordinate of the window relative to the screen
screenTop Returns the y coordinate of the window relative to the screen
screenX Returns the x coordinate of the window relative to the screen
screenY Returns the y coordinate of the window relative to the screen
self Returns the current window
status Sets the text in the statusbar of a window
top Returns the topmost browser window

Window Methods

alert() Displays an alert box with a message and an OK button
blur() Removes focus from the current window
clearInterval() Clears a timer set with setInterval()
clearTimeout() Clears a timer set with setTimeout()
close() Closes the current window
confirm() Displays a dialog box with a message and an OK and a Cancel button
focus() Sets focus to the current window
moveBy() Moves a window relative to its current position
moveTo() Moves a window to the specified position
open() Opens a new browser window
print() Prints the content of the current window
prompt() Displays a dialog box that prompts the visitor for input
resizeBy() Resizes the window by the specified pixels
resizeTo() Resizes the window to the specified width and height
scrollBy() Scrolls the content by the specified number of pixels
scrollTo() Scrolls the content to the specified coordinates
setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds

Navigator Properties

appCodeName Returns the code name of the browser
appName Returns the name of the browser
appVersion Returns the version information of the browser
cookieEnabled Determines whether cookies are enabled in the browser
platform Returns for which platform the browser is compiled
userAgent Returns the user-agent header sent by the browser to the server

Navigator Methods

javaEnabled() Specifies whether or not the browser has Java enabled
registerContentHandler() Registers a content handler for a specific MIME type
registerProtocolHandler() Registers a protocol handler for a specific protocol

Screen Properties

availHeight Returns the height of the screen (excluding the Windows Taskbar)
availWidth Returns the width of the screen (excluding the Windows Taskbar)
colorDepth Returns the bit depth of the color palette for displaying images
height Returns the total height of the screen
pixelDepth Returns the color resolution (in bits per pixel) of the screen
width Returns the total width of the screen

History Properties

length Returns the number of URLs in the history list

History Methods

back() Loads the previous URL in the history list
forward() Loads the next URL in the history list
go() Loads a specific URL from the history list

Location Properties

hash Returns the anchor portion of a URL
host Returns the hostname and port of a URL
hostname Returns the hostname of a URL
href Returns the entire URL
pathname Returns the path name of a URL
port Returns the port number the server uses for a URL
protocol Returns the protocol of a URL
search Returns the query portion of a URL

Location Methods

assign() Loads a new document
reload() Reloads the current document
replace() Replaces the current document with a new one

DOM Node

Node Properties

attributes Returns a collection of a node's attributes
baseURI Returns the absolute base URI of a node
childNodes Returns a NodeList of child nodes for a node
firstChild Returns the first child of a node
lastChild Returns the last child of a node
localName Returns the local part of the name of a node
namespaceURI Returns the namespace URI of a node
nextSibling Returns the next node at the same node tree level
nodeName Returns the name of a node, depending on its type
nodeType Returns the type of a node
nodeValue Sets or returns the value of a node, depending on its type
ownerDocument Returns the root element (document object) for a node
parentNode Returns the parent node of a node
prefix Sets or returns the namespace prefix of a node
previousSibling Returns the previous node at the same node tree level
textContent Sets or returns the textual content of a node and its descendants

Node Methods

appendChild() Adds a new child node, to the specified node, as the last child node
cloneNode() Clones a node
compareDocumentPosition() Compares the document position of two nodes
getFeature(feature, version) Gets a DOMImplementation object
getUserData(key) Returns the current user data associated with a key on a node
hasAttributes() Returns true if a node has any attributes, otherwise it returns false
hasChildNodes() Returns true if a node has any child nodes, otherwise it returns false
insertBefore() Inserts a new child node before a specified, existing, child node
isDefaultNamespace() Returns true if the specified namespaceURI is the default, otherwise false
isEqualNode() Checks if two nodes are equal
isSameNode() Checks if two nodes are the same node
isSupported() Returns true if a specified feature is supported on a node, otherwise false
lookupNamespaceURI() Returns the namespace URI matching a specified prefix
lookupPrefix() Returns the prefix matching a specified namespace URI
normalize() Joins adjacent text nodes and removes empty text nodes
removeChild() Removes a child node
replaceChild() Replaces a child node
setUserData(key, data, handler) Associates an object to a key on a node

RegExp

Modifiers

i Perform case-insensitive matching
g Perform a global match (find all matches rather than stopping after the first match)
m Perform multiline matching

Brackets

[abc] Find any character between the brackets
[^abc] Find any character not between the brackets
[0-9] Find any digit from 0 to 9
[A-Z] Find any character from uppercase A to uppercase Z
[a-z] Find any character from lowercase a to lowercase z
[A-z] Find any character from uppercase A to lowercase z
[adgk] Find any character in the given set
[^adgk] Find any character outside the given set
(red|blue|green) Find any of the alternatives specified

Metacharacters

. Find a single character, except newline or line terminator
\w Find a word character
\W Find a non-word character
\d Find a digit
\D Find a non-digit character
\s Find a whitespace character
\S Find a non-whitespace character
\b Find a match at the beginning/end of a word
\B Find a match not at the beginning/end of a word
\0 Find a NUL character
\n Find a new line character
\f Find a form feed character
\r Find a carriage return character
\t Find a tab character
\v Find a vertical tab character
\xxx Find the character specified by an octal number xxx
\xdd Find the character specified by a hexadecimal number dd
\uxxxx Find the Unicode character specified by a hexadecimal number xxxx

Quantifiers

n+ Matches any string that contains at least one n
n* Matches any string that contains zero or more occurrences of n
n? Matches any string that contains zero or one occurrences of n
n{X} Matches any string that contains a sequence of X n's
n{X,Y} Matches any string that contains a sequence of X to Y n's
n{X,} Matches any string that contains a sequence of at least X n's
n$ Matches any string with n at the end of it
^n Matches any string with n at the beginning of it
?=n Matches any string that is followed by a specific string n
?!n Matches any string that is not followed by a specific string n

RegExp Properties

global Specifies if the 'g' modifier is set
ignoreCase Specifies if the 'i' modifier is set
lastIndex The index at which to start the next match
multiline Specifies if the 'm' modifier is set
source The text of the RegExp pattern

RegExp Methods

exec() Tests for a match in a string. Returns the first match
test() Tests for a match in a string. Returns true or false