-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayiteration.js
More file actions
53 lines (53 loc) · 883 Bytes
/
Copy patharrayiteration.js
File metadata and controls
53 lines (53 loc) · 883 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var arr=["carrom","Chess","tabletenis","busines","tv"];
var tex="";
arr.forEach(myfunc);
function myfunc(index)
{
tex=tex+index+"\n"
}
console.log(tex);
var num=[5,4,18,8,2,15,32];
var nnum=num.map(myfunci);
function myfunci(values,index,array)
{
return values*2
}
console.log(nnum);
var gret=num.filter(myfu);
function myfu(value,index,array)
{
return value>10
}
console.log(gret);
var add=num.reduce(mye);
var tot=0;
function mye(tot,value,index)
{
tot=tot+value;
return tot;
}
console.log(add);
var ev=num.every(eve);
function eve(value,index)
{
return value>1;
}
console.log(ev);
var so=num.some(sow);
function sow(value,index)
{
return value>10
}
console.log(so);
var fin=num.find(findo);
function findo(value,index)
{
return value>7;
}
console.log(fin);
var findinde=num.findIndex(fins);
function fins(value,index)
{
return value>7;
}
console.log(findinde);