CSS - Practical 3
CSS - Practical 3
Q7. Write a program to delete the element from the array using different methods.
Code:-
<html>
<head>
<title>Anas Qureshi-220440</title>
<script>
document.write("Anas Qureshi-220440<hr>")
let array = [10, 5, 40, 30, 50, 60, 70, 15, 35]
document.write(`Array before deleting any element:-<br>[${array}]<hr>`)
document.write(`Deleting element in array using pop(), it will delete the last element of
array<br>`)
array.pop()
document.write(`[${array}]`+`<hr>`)
document.write(`Now deleting element in array using delete-<br>`)
delete array[3]
document.write(`[${array}]`+`<hr>`)
document.write(`Now deleting element in array using shift(), which will delete element from
begining of array-<br>`)
array.shift()
document.write(`[${array}]`)
</script>
</head>
<body>
</body>
</html>
Output:-