This table shows each JavaScript method in action...
JavaScript | Result |
---|---|
undefined | |
Arrays | |
var a = new Array; a.push(2,3); a.push("Hello world."); a[7] = 7; a[10] = 10; |
|
a.pop(); | |
a.unshift("a","b","c"); | |
a.shift(); | |
a.splice(2,2,"one", "two"); | |
Dates | |
var d = new Date; d.toDateString(); d.toUTCString(); d.toTimeString(); d.toLocaleTimeString(); d.toLocaleDateString(); |
|
Numbers | |
(12.3456789).toFixed(5); (12.3456789).toExponential(3); (12.3456789).toPrecision(4); |
|
Strings | |
"JavaScript".localeCompare("javascript"); "Java".localeCompare("javascript"); |
|
"JavaScript".charCodeAt(5); |
|
"JavaScript".toLocaleUpperCase(); "JavaScript".toLocaleLowerCase(); |