- 论坛徽章:
- 0
|
照着那个make yourselves a scheme in 48 hours的教程来的,不过貌似用了不止48个小时
懒得介绍语法了,放几个demo
var arr=[1,2,3,4];
arr << 1 << 2;
puts(arr);
var hash={'a':1,'b':2};
hash['c']=hash['a']+hash['b'];
hash['c']=1;
puts(hash);
function makeAdder(num){
var this={
'count':num,
'add':function(num){
this['count']=this['count']+num;
}
};
return this;
}
var adder = makeAdder(2);
(adder['add'])(1);
(adder['add'])(1);
adder['add'](1);
adder['count'];
puts('************');
function makeCounter(init){
var this={
'n':init,
'add':function(n){
this['n']=this['n']+n;
return this['n'];
}
};
return this;
}
var counter=makeCounter(1);
puts((counter['add'])(2)); --3
puts(counter['add'](3)); --6 |
windows下的可执行文件按及源码见 http://code.google.com/p/fineday/
 |
|