Suppose I have a simple javascript array like such:
var test_array = ["18081163__,0,0.15,15238", "34035", "Somerset", "Local", "31221", "29640", "42575", "749", "1957", "45809", "17597", "43903", "1841", "1", "Norfolk Road", "Other"]
It has a length = 16. I want to remove all items based on index except [0, 2, 3, 14]. I know I could use splice to do it piece by piece like such:
test_array.splice(1,1);
test_array.splice(3, 10);
test_array.splice(4, 1);
How could this be done in a single line of code to remove items with index [1, 4,5,6,7,8,9,10,11,12,13,15]?
test_array? what array of indices do you have? the one to keep or the one to delete