Question:Briefly describe JavaScript core Array method pop() with an example. 

Answer Array.pop() method removes the last element of an array and returns it.Example:
var stackWork=new Array("Lenny","Harold","Mary","Jean","Sal");
  var item=stackWork.pop();
  document.write(item);
  document.write("<br/>")
  document.write(stackWork);
Output: Sal Lenny,Harold,Mary,Jean 

+ Report
Total Preview: 941
Briefly describe JavaScript core Array method pop() with an example.
Copyright © 2024. Powered by Intellect Software Ltd