Riddle me this:

Is there a JavaScript equivalent to the PHP HTMLSpecialChars() function?

I normally use PHP, but today I'm working on a PowerDynamo site, and my server-side JS isn't up to snuff.