-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08_array.js
More file actions
75 lines (39 loc) · 1.04 KB
/
08_array.js
File metadata and controls
75 lines (39 loc) · 1.04 KB
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
54
55
56
57
58
59
60
let arr=[23,24,25,26,27,28]
console.log(arr);
console.log(arr.length);
console.log(arr.includes(27));
console.log(arr.reverse());
console.log(arr.sort((a,b)=>a-b));
console.log(arr.concat([56,57,58]));
console.log(arr.push(90));
console.log(arr);
console.log(arr.pop());
console.log(arr);
console.log(arr.unshift(111));
console.log(arr);
console.log(arr.shift());
console.log(arr);
console.log(arr.toString());
console.log(arr.join("-Cui-Atd "));
let sliceArray=arr.slice(0,4);
console.log(arr);
console.log(sliceArray);
let spliceArray=arr.splice(0,3,1111,2222,3333,4444,5555,6666,7777)
console.log(spliceArray);
console.log(arr);
let stringSentence="hiiiii i am stirnt"
let arrayFromString=Array.from(stringSentence)
console.log(arrayFromString);
arr=[11,22,333,444,555,66,77,88]
let newArray=arr.map((e)=>{
return `Sp21-bcs-0${e}`;
})
console.log(newArray);
let filterArray=arr.filter((e)=>{
return e<78;
})
console.log(filterArray);
let reduceArray=arr.reduce((a,b)=>{
return a+b;
})
console.log(reduceArray);