Quoted quotes dilemma in JavaScript

I declare a string (xpath) like this:

property xpSeeAllFriends : "//span[text() = 'See all friends']"

I then use this property to create a short JavaScript like this:

set JSSeeAllFriends to "document.evaluate('" & xpSeeAllFriends & JSSeeAllFriendsSuffix

which I then send to a method like this to execute it:

set seeAllFriends to my tryJavaScript(JSSeeAllFriends)

In this method the JavaScript is further manipulated:

on tryJavaScript(js)
set js to "try{" & js & "}catch{null};"
do JavaScript js

Finally, in the console this is the result:

do JavaScript "try{document.evaluate('//span[text() = 'See all friends']', document, null, XPathResult.STRING_TYPE, null).stringValue}catch{null};"

This causes a problem with the quotes. The outermost quote character is ", followed by ’ in the second level but then the third level also uses ', which obviously breaks the whole thing.

How do I fix this?

I use the tryJavaScript-method a lot and rewriting the quotes there would mean that I would need to rewrite both many JS-strings, as well as the xpath strings that are included in these JS-strings, as well as many call to that method, which I obviously would prefer to avoid.