Skip to content

Instantly share code, notes, and snippets.

@HunterLarco
Last active December 7, 2020 20:30
Show Gist options
  • Save HunterLarco/29666843a504a6778f8a723abd2447bd to your computer and use it in GitHub Desktop.
Save HunterLarco/29666843a504a6778f8a723abd2447bd to your computer and use it in GitHub Desktop.
function strip(str) {
let start = 0;
let end = str.length - 1;
let startCache = '';
let endCache = '';
while (str[start] != '(') {
if (str[start] != ')') {
startCache += str[start];
}
++start;
}
while (str[end] != ')') {
if (str[end] != '(') {
endCache += str[end];
}
--end;
}
return startCache + str.substring(start, end + 1) + endCache;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment