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] ="anything"; |
create array with data |
var myArray = ["entry1", "entry2",...]; |
ad extra entry in my Array |
myArray.push ("next entry"); |
Delete y entries from x |
myArray.splice(x, y); |
Add record on position X in Array |
myArray.splice(x, 0, data); |
Replace record on position X in Array |
myArray.splice(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} |
|
|
getElementBy...
Id |
Id |
ClassName |
Class |
TagName |
HTML tag |
querySelectorAll("p.intro") |
CSS Selectors |
|