Get all array elements except for first and last Get all array elements except for first and last arrays arrays

Get all array elements except for first and last


Since there is no data I am taking a basic array to show. Also by this method you will preserve your original array.

var arr = [1,2,3,4,5,6,7];var middle = arr.slice(1, -1);console.log(middle);