In Perl regular expressions, you can surround a subexpression with \Q and \E to indicate that you want that subexpression to be matched as a literal string even if there are metacharacters in there.  You also have the quotemeta function that inserts exactly the right number of backslashes in a string so that if you subsequently interpolate that string into a regular expression, it will be matched literally, no matter what its contents were.
Does Javascript (as deployed in major browsers) have any built in equivalent? I can write my own just fine, but I would like to know if I don't have to bother.