discord-baymax-bot/node_modules/reduce-component/test/index.html
2017-03-23 23:52:08 -05:00

30 lines
604 B
HTML

<html>
<head>
<title>reduce component</title>
</head>
<body>
<script src="../build/build.js"></script>
<script>
var reduce = require('reduce');
var items = [0, 1, 2, 3, 4, 5];
var none = [];
var a = reduce(items, concat);
var b = reduce(items, sum);
var c = reduce(items, sum, 10);
console.log('concat: %s', a);
console.log('sum: %s', b);
console.log('sum + 10: %s', c);
function concat(prev, curr, idx, arr) {
return String(prev) + String(curr);
}
function sum(prev, curr){
return prev + curr;
}
</script>
</body>
</html>