Prepack is rather nice. It allows you to execute part of your code at compile time, like a macro.
function add5(x) {
return x + 5;
}
console.log(add5(3));
compiles down to console.log(8);Unlike GCC, it can unroll any kind of metaprogramming, but it needs to have a model of the environment (e.g. it won’t execute code relying on DOM) and it can produce larger code (in terms of absolute size).
Admittedly it doesn't take JS as input, but I was somewhat confused when I read your comment nonetheless.
Also if you need faster numeric calculations https://github.com/non/spire (has scala.js support)