Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 210 Bytes

File metadata and controls

9 lines (7 loc) · 210 Bytes
// reverse a string from a given index
function reverseString(str, index) {
  return str.slice(0, index) + str.slice(index).split("").reverse().join("");
}

console.log(reverseString("abcdefg", 2));