Home  Writing  Games  Music  Dev  About 

Why Javascript?

I mean, why? Why is Javascript used everywhere, and so much.

A lot of it is due to the fact that it is the scripting language of choice of web browsers.

Javascript can have different engines behind it. The spidermonkey engine is written in C++. So Javascript is compiled to c++ at some point. The V8 Engine provided by Google is used in Chrome and in Nodejs.

I guess my question was, why not use C++ directly in the browser?

But I guess the answer would be the same as for a lot of scripting languages. Even Python is compiled to C before translation to machine code.

So why not use C instead of Python? That is obvious, for many areas and applications are just easier to program and think about in python.

I guess there is no reason to limit oneself to Javascript in the browser. There must be other engines or compilers for languages that can interface between the browser and the language and the system.

It is not a bad idea to look further into these engines though. Can help me learn more about JS, C++ and language/compiler design.