Show Menu
Cheatography

javaScript by TAdam Cheat Sheet (DRAFT) by

none for now

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Arrays

create myArray
var myArray = nev Array();
create an entry
myArray [n] ="an­yth­ing­";
create array with data
var myArray = ["en­try­1", "­ent­ry2­"­,...];
ad extra entry in my Array
myArra­y.push ("next entry");
Delete y entries from x
myArra­y.s­pli­ce(x, y);
Add record on position X in Array
myArra­y.s­pli­ce(x, 0, data);
Replace record on position X in Array
myArra­y.s­pli­ce(x, 1, data);

Loops

for ( var i=0; i<5; i++) {...}
for (from where; until what; counting this way) {do that}
var i=0; while (i<n) {... ; i++}
i define outside; while (until what) {do that; i counting this way}
 

getEle­men­tBy...

Id
Id
ClassName
Class
TagName
HTML tag
queryS­ele­cto­rAl­l("p.in­tro­")
CSS Selectors