i have the following:
var S=\"hi how are you\";
var bindex = 2;
var eindex = 6;
how can i remove all the chars from S that reside between
The following function returns the complementary result of slice function:
String.prototype.remainderOfSlice = function(begin, end) {
begin = begin || 0
end = (end === undefined) ? this.length : end
if (this.slice(begin, end) === '') return this + ''
return this.slice(0, begin) + this.slice(end)
}
examples:
"hi how are you".slice(2, 6) // " how"
"hi how are you".remainderOfSlice(2, 6) // "hi are you"
"hi how are you".slice(-2, 6) // ""
"hi how are you".remainderOfSlice(-2, 6) // "hi how are you"