javascript基础学习一:类
function Shape()
{
var init = function(){
} //模拟构造函数
init();
this.x = 1; //公有属性
this.y = 2;
this.draw = function(){
console.log( this.x + this.y);
}; //公有方法
}
var ashape = new Shape();
console.log(ashape.x);
ashape.draw();
类属性\方法的定义:
Shape.count = 10
Shape.staticMethod = function(){}
浙公网安备 33010602011771号