Skip to content

Instantly share code, notes, and snippets.

@stleamist
Last active February 7, 2020 05:43
Show Gist options
  • Save stleamist/42715fd5b5d71f7d48656d606fa62608 to your computer and use it in GitHub Desktop.
Save stleamist/42715fd5b5d71f7d48656d606fa62608 to your computer and use it in GitHub Desktop.
Array.prototype.replace = function(replacingArray, startIndex = 0) {
const replacedArray = this.slice()
Array.prototype.splice.apply(replacedArray, [startIndex, replacingArray.length].concat(replacingArray))
return replacedArray
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment