You can run your private JavaScript server side e.g. using ASP JScript.NET
<% WebService Language="JScript" Class="MyClass" %>
You can put the hidden functionality on the server and call it via AJAX in the non hidden part of the code on the client.
you can also use