-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.js
More file actions
31 lines (30 loc) · 742 Bytes
/
map.js
File metadata and controls
31 lines (30 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const a = [10,120,2323];
// const b = a.map(e=>2020-e);
// const c = a.filter(e=>e>100);
// // Array.prototype.map= function(d){
// // const k=[];
// // this.forEach(a=>k.push(d[a]));
// // return k;
// // }
// // Array.prototype.filte1=(d,e)=>{
// // const k=[10,20];
// // this.forEach(i=>console.log(i));
// // return k;
// // }
// const map = (arr,callBack)=>{
// let ans = [];
// console.log(callBack);
// for(let i=0; i<arr.lenght; i++){
// let b = callBack(arr[i]);
// if(b){
// ans.push(arr[i]);
// console.log(b);
// }
// }
// return ans;
// };
// const p = map(a, e=>2020-e);
const l = a.reduce((a,b)=>{
return a+b;
});
console.log(l);