Someone have a function that finds the “(” which is correlate with a “)”?

For example,
if I have this variable:

let text = "fds(jgfdk(fsds)fda(fdfafda)fdsa)"

I look for a function that with the index of its ), returns the index of its (.

I don’t know any easy form to get it.

findParenthesis(31)  // must return 3
findParenthesis(26)  // must return 18