Many web games compile to web assembly I believe. I have never done this from scratch, but asm.js is a popular tool for this. Here's from the wikipedia:
asm.js is a subset of JavaScript designed to allow computer software written in languages such as C to be run as web applications