December 2013
Intermediate to advanced
384 pages
9h 54m
English
var week = ["sun", "Mon", "Tue", "Wed", "thur", "Fri", "sat"]; var weekdays = week.splice(1,5); var day = week.pop(); // weekdays= ["Mon", "Tue", "Wed", "thur", "Fri"] // day = "sat" // week = ["sun", "Mon", "Tue", "Wed", "thur", "Fri"];
You can remove the last item in the array using pop(). If you want to remove items in the middle of the array, you need to use splice(index, count), where index is the index to begin removing items from and count is the number of items to remove.
Read now
Unlock full access