Created
April 2, 2021 15:38
-
-
Save Otto-Vector/b3987d1cc772f4185c02c7702e2e23e8 to your computer and use it in GitHub Desktop.
delAtIdxFromStr
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
//Удалить из строки по индексам | |
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