while (j<secondSpecsArr.length) {
console.log(j);
if (regStr.test(secondSpecsArr[j])){
console.log('slice operation' + j + ' ' + secondSpecsArr[j]);
secondSpecsArr.slice(j,1);
} else { j++; }
}
I am deleting elements from Array, that include string 'strong'.
But its not deleting at least anything!
Like,console.log('slice operation' + j + ' ' + secondSpecsArr[j]);` is working, but slice() isn'nt, and I get old array after this. Where's the problem?
Array.prototype.slice(): "The slice() method returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included). The original array will not be modified."slicedid not change your array. Usespliceinstead.