编程科学/SwayPresentation/对象/示例
外观
示例
with怎么样?
function with(obj,$actions) { $actions . context = obj; force($actions); }
我们来创建一个对象
function f(x) { var y = x + 1; this;} var o = f(3);
现在来修改其槽
with (o) { x = 10; y = 13; }
有效吗?
inspect(o . x); inspect(o . y);
输出
o . x is 10 o . y is 13