Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let arr = [0, 1, 2];
- let even = arr.map(function(x) { return 2 * x; });
- let odd = arr.map(function(x) { return 2 * x + 1; });
- console.log(even);
- console.log(odd);
- let small = even.concat(odd).filter(function(x) {
- return x < 3;
- });
- console.log(small);
- small.filter(function(x) {return x === 0; });
- console.log(small);
- small.forEach(function(x, i){
- console.log('arr[' + i + ']=' + x);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement