-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush-pop,shift-del-fun-prg.html
107 lines (51 loc) · 2.14 KB
/
push-pop,shift-del-fun-prg.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Functions</title>
</head>
<body>
<script>
// Push-Pop-Shift-delete-Function
const Engineers=["Data-scientist" , "Computer-scientist" , "Android-developer / IOS" , "Software-developer" ,
"Domain-expert" , "Tetster" , "Quality-Assurance" , "Stake-holders"];
Engineers.push("Programmers" , "Hackers Jonathan James" , 0100);
// Engineers.pop();
// Engineers.shift();
// Engineers.shift("Data-scientist");
// Engineers.unshift("Black-Hat-Hackers" , "White-Hat-Hacker");
// const arr =Engineers.slice(2,7);
// const arr =Engineers.slice(2,-7);
console.log(Engineers);
// console.log(arr)
/* Push() :
The push() method adds new items to the end of an array.
The push() method changes the length of the array.
The push() method returns the new length.
syntax :
array.push(item1, item2, ..., itemX)
Pop() :
The pop() method removes (pops) the last element of an array.
The pop() method changes the original array.
The pop() method returns the removed element.
syntax :
array.pop()
Shift() :
The shift() method removes the first item of an array.
The shift() method changes the original array.
The shift() method returns the shifted element.
unshift() :
The unshift() method adds new elements to the beginning of an array.
The unshift() method overwrites the original array.
slice() :
The slice() method returns selected elements in an array, as a new array.
The slice() method selects from a given start, up to a (not inclusive) given end.
The slice() method does not change the original array.
syntax :
array.slice(start, end)
*/
</script>
</body>
</html>