You can use the Esprima JavaSript parser (the link is a online code editor ready to use).
I believe it's currently the best ready-to-use js parser in js, that's why I'm using it in my LIVEditor project (code editor for the html/css/js with real-time preview).