You can write in most languages in the browser right now, and it's getting easier and more popular as time goes by. There are many serious downsides, as well as compelling advantages.
Some downsides to using a different language:
Of course, there are benefits from using other languages. Most of them only show up with large, long-lived applications:
There are three main categories of alternate languages to be aware of:
JavaScript is popular enough that most major languages have tools to "compile" them to JavaScript. If you already "speak" one of these languages then they can be a great option to bring your existing code and expertise to the web.
Each of these languages were designed by very smart people with a JavaScript background to solve real-world problems. They are definitely not a good idea if you're making small apps, since ES2016 is pretty good anyway and you'll lose compatibility with the existing ecosystem. However if you're making a large webapp that's going to be used in production and have features added over time, then you should definitely consider these languages:
There are more, but I'll stop there since those are the biggest.
TL;DR: If you want to make video games, write them with Unity and they'll run everywhere, including the web.
One big problem with all these "compile-to-js" languages is that Javascript is kinda slow. It is weakly typed and so the javascript engines have to do crazy on-the-fly recompilations as the data changes for maximum performance.
If only there was some kind of low-level language which we could run in the browser but which didn't need any kind of optimizing engine. Like an assembly language for the web.
Enter ASM.js: ASM.js is a very ugly subset of javascript that looks like this:
function strlen(ptr) {
ptr = ptr|0;
var curr = 0;
curr = ptr;
while (MEM8[curr]|0 != 0) {
curr = (curr + 1)|0;
}
return (curr - ptr)|0;
}
Notice all the |0? Those are valid Javascript which casts the values to integers. A smart JavaScript engine will pick up on that and produce much faster code. ASM.js also does some other things like manually managing it's own memory in a TypedArray which means no pauses for Garbage Collection. With these optimizations paired with a browser that's also been optimized for ASM.js, you can usually get within 1/2 the performance of native code.
Another important tool is Emscriptem which compiles C/C++ code to ASM.js. (I'm simplifying here. Go check it out if you want the full story.) Thanks to the great performance of ASM.js, people have been able to compile entire video games for the browser. In fact, Unity, which is one of the most popular video game engines, can export to asm.js as one of it's official targets!
ASM.js is just about as far as you can push regular JavaScript. But thankfully, the browser vendors have come together to give us something even better: WebAssembly.
WebAssembly is a cross-platform assembly language that's safe to run with untrusted code. This means that, someday soon, almost any language will be able to compile for the browser without sacrificing speed or having subtle quirks due to JavaScript's limitations.
The future is bright for assembly languages on the web. ASM.js already works in all modern browsers and WebAssembly works in Firefox Nightly and Chrome Canary. If you want to have a taste of the future go check out this video game demo which has both ASM.js and WebAssembly versions.
If you're looking to get into front end development, then JavaScript is still the way to go. JavaScript is one of the few languages that actually has a job deficit, so it's a very good career move.
Whatever company you get a job for will probably already have decided whether to use vanilla JS or some other language, and won't be interested in changing. If they use some alternate language, then their strategy will probably be to hire JS developers and train them in.