javascript_王者归来_学习札记(一)类和对象
javascript_王者归来_学习笔记(一)类和对象
第一种方式
var obj = new Object();
obj.a ="2";
obj.b="3";
obj.change=fucntion()
{
alert('hello');
}
第二种方式
var obj = {x:1,y:2}
第三种方式
function test(x,y)
{
this.x = x;
this.y=y;
}
第一种方式
var obj = new Object();
obj.a ="2";
obj.b="3";
obj.change=fucntion()
{
alert('hello');
}
第二种方式
var obj = {x:1,y:2}
第三种方式
function test(x,y)
{
this.x = x;
this.y=y;
}