Shift-1

 

JavaScript Shift() function is used to remove the first element of array and return the same element. See code snippet:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <button onclick="removeElement()">Remove the first element</button> <p id="sample"></p> <script> var arr= ['abc', 'def', 'ghi', 'jkl']; document.getElementById("sample").innerHTML = arr; function removeElement() { arr.shift(); document.getElementById("sample").innerHTML = arr; } </script> </body> </html>
Output