The JavaScript array pop() method is used to remove and return the last element of an array.
Syntax:
array.pop()
Syntax:
It will return 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>