Just pick a better language (e.g. Python/Ruby/Groovy/C#). Period. And JavaScript was never as horrible as PHP anyway, in my opinion.
The thing is, you have more control over what language you can run on the server-side, whereas all your web browser clients run JavaScript. So it made sense to have a transpiler targeting JavaScript.
The thing is, you have more control over what language you can run on the server-side, whereas all your web browser clients run JavaScript. So it made sense to have a transpiler targeting JavaScript.