You're not being very specific so I'm just going to point you to the article that explains this on processingjs.org: http://processingjs.org/articles/PomaxGuide.html#interface
That explains how to make your sketch use JavaScript functions (don't access raw variables), and how to make JavaScript call your sketch functions (again, don't access raw variables, write a getter function and call that).