I am very beginner in JavaScript.
I have an string array like this : 123,432,123,543,123,123
I want to remove the 3dr number from this string.
I have found following function to remove a text value from an string array, but it's not working for arrays with duplicated values in them.
Array.prototype.removeByValue = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
this.splice(i, 1);
break;
}
}
}
Any suggestions to solve this issue is appreciated.
[123, 432, 123, 543, 123, 123]
. You just want to remove the third element, no matter what it is? – lonesomeday Mar 14 '13 at 13:26