CodesJava

Easy learning with example program codes

JavaScript Array pop() method

The JavaScript array pop() method is used to remove and returns the last element of an array.

Syntax:

array.pop()

Syntax:
It will returns the last element of an array.

Example:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>  
var a = ["GOLD","SILVER","DIAMOND","RUBY","PLATINUM"] 	 
document.writeln(a.pop()+"<br>"+"<br>");  
document.writeln(a);  
</script>  
</body>
</html>

Output:

GOLD,SILVER,DIAMOND,RUBY
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status