I want to escape single and double quotes with a backslash in one line rather than two.
Example for single quote:
str = str.replace(/\'/g, \"\\\\\'\"); <