Question:Briefly describe JavaScript core Array method shift() with an example.
Answer
Array.shift() method removes the first element in an array and returns it.Example:var stackWork=new Array("Lenny","Harold","Mary","Jean","Sal"); var item=stackWork.shift(); document.write(item); document.write("<br/>") document.write(stackWork);Output: Lenny Harold,Mary,Jean,Sal,Delia