0% found this document useful (0 votes)
75 views

JS Cheat Sheet

This document provides a visual reference for JavaScript including sections on variables, operators, conditionals, loops, functions, arrays, strings, DOM, window properties and methods, and document properties and methods. It summarizes key concepts like reserved keywords, binary operators, precedence, string escape characters and methods, array methods, function statements and expressions, IIFE, DOM overview, common window and document properties and event handlers, and popular window and document methods.

Uploaded by

ellsie
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

JS Cheat Sheet

This document provides a visual reference for JavaScript including sections on variables, operators, conditionals, loops, functions, arrays, strings, DOM, window properties and methods, and document properties and methods. It summarizes key concepts like reserved keywords, binary operators, precedence, string escape characters and methods, array methods, function statements and expressions, IIFE, DOM overview, common window and document properties and event handlers, and popular window and document methods.

Uploaded by

ellsie
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JAVASCRIPT VISUAL REFERENCE

Variables Reserved keywords Bit operators

Operators Binary Operators

Precedence

String Escape Characters String properties


\’ \r
\” \t charAt() Returns the character at the specified index (position)
\\ \b charCodeAt() Returns the Unicode of the character at the specified index
\n \f 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
Conditionals lastIndexOf() Returns the position of the last found occurrence of a specified value in a string
localeCompare() Compares two strings in the current locale
match() Searches a string for a match against a regular expression, and returns the matches
replace() Searches a string for a value and returns a new string with the value replaced
search() Searches a string for a value 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 a part of a string from a start position through a number of characters
Loops substring() Extracts a part of a string between two specified positions
toLocaleLowerCase() Converts a string to lower case letters, according to the host's locale
toLocaleUpperCase() Converts a string to upper case letters, according to the host's locale
toLowerCase() Converts a string to lowercase letters
toString() Returns the value of a String object
toUpperCase() Converts a string to upper case letters
trim() Removes whitespace from both ends of a string
valueOf() Returns the primitive value of a String object

Arrays concat() concat() RE


Arrays Methods

join() join() [abc] find any character between the brackets


push() add to the end [0-9] find any digit between the brackets
pop() remove and return the last item (x|y|z) find any of the separated with | sign
reverse() reverse the order of array items \d find a digit
shift() remove first item \s find any word
slice() create new array from existing array items + find one or more occurrences
sort() sort alphabetically ^ beginning of the string
splice() replace items $ end of string
unshift() add at the beginning ? zero or one
delete() delete any element . find any character except newline

Functions Function statement Scope Closure

Function expression

IIFE

jsvisually.com
DOM

open window in a browser

html document loaded into a browser

WINDOW Properties DOCUMENT Properties


closed returns boolean whether window is opened or not cookie
defaultStatus get/set property of default window status bar documentMode
document reference to the current document object domain
frames returns an array of all frames in the current widow lastModified
history returns URLs opened within the window readyState
innerHeight returns window’s height in pixels referrer
innerWidth returns window’s width in pixels title
length returns the number of frames in the current window URL
location get/set the current URL
name returns the name of the window
opener reference to the window that opened a secondary window EVENT Handlers
outerHeight returns entire window’s height in pixels onAbort onMouseDown
outerWidth returns entire window’s width in pixels onBlur onMouseMove
parent current window or frame set onChange onMouseOut
screenLeft onClick onMouseOver
screenTop X,Y coordinates of current window onDblClick onMouseUp
screenX relative to user’s screen onDragDrop onMove
screenY onError onReset
scrollX returns scroll’s X location from upper left corner onFocus onResize
scrollY returns scroll’s Y location from upper left corner onKeyDown onSelect
self current window onKeyPress onSubmit
status get/set the content of browser’s status bar onKeyUp onUnload
top topmost browser window onLoad

WINDOW Methods DOCUMENT Methods


alert() displays a dialog box with the specified message and OK button close()
blur() removes focus from the window and brings it to the background open()
clearInterval() clears a timer set with the setInterval() method getElementById()
clearTimeout() clears a timer set with the setTimeout() method getElementByName()
close() closes a window getElementByTagName()
confirm() displays a dialog box with the specified message and OK and Cancel buttons write()
focus() sets focus to the window. Brings the window to the front writeln()
moveBy() moves a window by the specified amount in pixels.
moveTo() moves a window to the specified coordinates in pixels
open() opens a new browser window
print() prints the content of a window or frame
prompt() displays a dialog box with a message and returns a string
resizeBy() resizes a window by the specified amount in pixels
resizeTo() resizes a window to the specified values in pixels
scrollBy() scrolls a window by the specified amount in pixels
scrollTo() scrolls a window to the specified values in pixels
setInterval() calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout() calls a function or evaluates an expression after a specified time (in milliseconds)

jsvisually.com

You might also like