Most of the security holes are the same sort of holes as with SQL injection, namely concatenating user input into JavaScript code. The difference being that while there are ways to ensure this doesn't happen with SQL, there's not much you can do with JavaScript.
As a trivial and useless example, a simplistic JavaScript calculator:
textbox1.value = eval(textbox2.value);
One correct usage examples are some of the JavaScript packers that compress JavaScript by pulling out common words and replacing them with short 1-2 character replacements. The packer then outputs all this along with string replacement code based on the dictionary generated then evals the result.