I have a variable of array like this:
dateArray = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
Now I wanted to remove the first 12 elements of the dateArray. I tried the code below but it's not working still. I used splice but I don't know what I'm missing.
if(dateArray.length>12){
for(var d= 0; d <12; d++){
dateArray.splice(d);
}
console.log(dateArray);
}
It outputs empty array: []
what I wanted it to remove only the first 12 and the output should be:
[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
Any help would be much appreciated.