Javascript can be, and should be, compiled into caja, which is a safe subset of Javascript. Unfortunately, this solution is only available for servers, not end users.