diff options
Diffstat (limited to 'tests/manual/v4/fun.4.js')
-rw-r--r-- | tests/manual/v4/fun.4.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/manual/v4/fun.4.js b/tests/manual/v4/fun.4.js new file mode 100644 index 0000000000..b130acccd3 --- /dev/null +++ b/tests/manual/v4/fun.4.js @@ -0,0 +1,18 @@ + +function foo(a,b,c) { + print("hello",a,b,c) +} + +foo.call(null, 1,2,3); + +[10,20,30].forEach(function (v,k,o) { print(v,k,o); }); + +print([10, 20, 30].every(function (v,k,o) { return v > 9 })); +print([10, 20, 30].some(function (v,k,o) { return v == 20 })); +print([10, 20, 30].map(function (v,k,o) { return v * v })); +print([10, 20, 30].filter(function (v,k,o) { return v >= 20 })); + +print([10,20,30].reduce(function(a,v,k,o) { return a + v })); +print([10,20,30].reduceRight(function(a,v,k,o) { return a + v })); + + |