I seem to be having a brain-freeze and am unable to remove JS array elements by index. Is there something fundamentally idiotic in the below?
var els;
[0, 1, 3]
0: 0
1: 1
2: 3
["Colour", "Font", "Icon", "Line 1"]
0: "Colour"
1: "Font"
2: "Icon"
3: "Text"
All I want to do is remove the elements from the array using index positions 0, 1 and 3 (in this example) - however, when I try this using splice, it messes up the indexes.
See:
els.each(function(key, val) {
console.log(key);
req-fields.splice(key,1);
});