Skip to content

Instantly share code, notes, and snippets.

@Otto-Vector
Created April 2, 2021 15:38
Show Gist options
  • Save Otto-Vector/b3987d1cc772f4185c02c7702e2e23e8 to your computer and use it in GitHub Desktop.
Save Otto-Vector/b3987d1cc772f4185c02c7702e2e23e8 to your computer and use it in GitHub Desktop.
delAtIdxFromStr
//Удалить из строки по индексам
let delAtIdx= (s,i) => s.slice(0,i)+s.slice(i+1)
//версия прототипа
String.prototype.delAtIdx = function (from, to) {
if (!to) to = from
to = Math.max(from,to)
from = Math.min(from,to)
return this.slice(0,from)+this.slice(to+1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment