Delete the first element of an array

walden systems, javascript, java script, array, delete, shift
a high-level, interpreted programming language that conforms to the ECMAScript specification. It is a language that is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm. Alongside HTML and CSS, JavaScript is one of the three core technologies of the World Wide Web.[9] JavaScript enables interactive web pages and thus is an essential part of web applications. The vast majority of websites use it,[10] and all major web browsers have a dedicated JavaScript engine to execute it.

Sometimes you might need to delete the first element of an array. There are many ways to accomplish this task and I would like to discuss one of the ways we are using here at Walden Systems, because we believe this is the most straightforward method to delete the first element of an array.

Strategy to deleting the first element of an array is straight forward and involves only one step: We will use is the built in JavaScript array function "shift( )".


Here is the code:

var list = ["item 1", "item 2", "item 3", "item 4"];
list.shift();


Now list will contain the following :

item 2
item 3
item 4