Need to shorten an array in JavaScript

When I take off the first item in the array, all I really do is shift the values up one index. Is there an easier way?

Anyway, I have this coded and it works. I would like to shorten the array by 1, so that calling the length property will be correct. How can I do that?

newbiewebSr. Software EngineerAsked:
Who is Participating?
var p = myarray.shift();  // put the first item of the array in p and remove it from the array
// Remove the first element of an array (this will also change the length of the array)

newbiewebSr. Software EngineerAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.