1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
| var a;
console.log(type("adsf"));
var arr1 = new Array(); var arr = []; var arr1 = new Array(5); var arr1 = new Array(5, 6, 7);
function show(x, y) { console.log(x); console.log(y); console.log(arguments); }
show(1, 2, 3, 4);
var result = show;
console.log(result);
alert(show(1, 2));
var add = new Function("x, y", "var sum; sum = x + y; return sum;"); console.log(add(4, 8));
var myShow = function(a, b) { return a + b; }
for (var x = 0; x < 3; x++) {
} console.log(x); for (var x = 0; x < 3; x++) {
}
function doSth() { var sp = 6; } console.log(sp);
console.log(doSth.toString()); console.log(doSth.valueOf());
with(date) { var first = getFullYear(); var second = getMonth(); }
for(var in obj) { console.log(var) }
parseInt(str) isNan(var)
String.prototype.len = 199;
String.prototype.trim = function () { var start, end; start = 0; end = this.length - 1; while (start <= end && this.charAt(start) == ' ') { start++; } while (start <= end && this.charAt(end) == ' ') { end--; } return this.substring(start, end + 1); }
String.prototype.toString = function() {}
function Person() { alert(); } var p = new Person(); p.name = "123";
p.show = function() { alert(this.name); } p.show();
function Person(name, age) { this.name = name; this.name = age; this.setName = function(name) { this.name = name; } this.getName = function() { return this.name; } }
var p = new Person(); p.setName("charf"); console.log(p.getName());
var person = { "name": "小明", "age": 38, "getName": function () { return this.name; } } console.log(person.getName());
console.log(person.name); console.log(person["name"]); for(x in p) { console.log(x); console.log(p[x]); }
var oPerson = ""; var bFlag = true; var iNumber = 1; var sLine = "1";
var myMap = { names:[{name1:"e"}, {age:12}] } console.log(myMap.names[0].name1);
var parent = document.getElementById("test"); var childNodes = parent.children[0]; parent.appendChild(childNodes);
document.scripts
|
v1.5.2