remove first n records on an array javascript code example
Example 1: javascript remove first item from array
var colors = ["red", "green", "blue"];
var red=colors.shift();
//colors is now ["green","blue"];
Example 2: javascript how to remove first element of array
var colors = ["red", "blue", "green"]
var firstColor = colors.shift()
console.log(firstColor) // red
console.log(colors) // blue green