test2.js

来自「《征服Ajax》原书的例题源码」· JavaScript 代码 · 共 24 行

JS
24
字号
function test1() {
	var _test = "test";
	this.p1 = "p1";
	this.p2 = "p2";
	this.f1 = function() {
		alert("f1");
	}
	this.f2 = function() {
		alert("f2");
	}
}

test1.staticProp = "staticProp test";
test1.staticMethod = function() {
	alert(test1.staticProp);
}

test1.prototype.prop2 = "prop2";
test1.prototype.method2 = function() {
	alert(this.prop2);
}

var t = new test1();
t.method2();

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?