Last active
December 7, 2020 20:30
-
-
Save HunterLarco/29666843a504a6778f8a723abd2447bd to your computer and use it in GitHub Desktop.
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
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