Created
August 29, 2017 06:18
-
-
Save geforester/87661a67ce4f51390de765e2d4311326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Удаление элемента из массива. | |
// String value: значение, которое необходимо найти и удалить. | |
// return: массив без удаленного элемента; false в противном случае. | |
Array.prototype.remove = function(value) { | |
var idx = this.indexOf(value); | |
if (idx != -1) { | |
// Второй параметр - число элементов, которые необходимо удалить | |
return this.splice(idx, 1); | |
} | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment