JavaScript Array push() method

The JavaScript array push() method is used to add one or more elements to the end of an array.

Syntax:

array.push (element1, element2....)

Parameters:
element1,element2… : Represents the elements to be added in an array.

Returns:
Original array with additional elements.

Example:

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

Output:

GOLD,SILVER,DIAMOND,RUBY,PLATINUM,BRONZE
Please Share