看到这样一段代码:
draw:function(point){
this.map[point.x/10][point.y/10] = 2;
Snake.drawRect("red", "black", point.x, point.y, 10, 10);
}
。
在后面的代码中就this.draw();直接调用了,感觉好像是一种匿名函数的定义形式,不知道我这样想对不对?还请高人指点迷津啊。
draw:function(point){
this.map[point.x/10][point.y/10] = 2;
Snake.drawRect("red", "black", point.x, point.y, 10, 10);
}
。
在后面的代码中就this.draw();直接调用了,感觉好像是一种匿名函数的定义形式,不知道我这样想对不对?还请高人指点迷津啊。
把value换成function(){}var a = {test:function(x,y){
return x+y;
}
};var val = a.test(1,2);
alert(val);