for (var p = 0, i = 0, le = arr.length; i < le; ++i) { if (!/^dd/.test(arr[i])) { arr[p++] = arr[i]; } } arr.length = p;