-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayProgram.html
More file actions
28 lines (23 loc) · 966 Bytes
/
Copy pathArrayProgram.html
File metadata and controls
28 lines (23 loc) · 966 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
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<t1> Program to use shift() method on Array...!</t1>
</head>
<body>
<p id=" demo"></p>
<p id=" demo1"></p>
<script>
let arr = ["abc","pqr","xyz","mno"];
document.getElementById(" demo").innerHTML = arr;
arr.push("add","sub");
//shift() used to delete the first value in the array and it return as welll
//unshift() method is used to add multiple value in an existing array.... from the starting position of an array .
//pop() method is used to delete the last element from the exiting array
//push() method is used to add multiple elements at the last of the array...
document.getElementById(" demo1").innerHTML = arr;
</script>
</body>
</html>