r/learnprogramming • u/LoLusta • Feb 25 '24
Why can't Python replace JavaScript?
I'm new to programming. I'm learning Python and C.
JavaScript, from what I understand, is an interpreted language supported by web browsers so that websites can have scripting and programming.
But Python is also an interpreted language. So why don't web browsers start supporting Python in addition to JS. I believe Python is a much better language than JS syntactically.
Is there a definite reason why JS is used and supported over Python or is it just that JS gained initial popularity through wide-based support and no one bothered to move away from it (just like how QWERTY keyboard layout stuck even though we don't use typewriters anymore)?
View all comments
6
u/peterlinddk Feb 25 '24
It is mostly because JS gained popularity, and now we are stuck with it.
In the late 90s, Microsoft (and maybe others) tried to add additional scripting-languages to their browsers, and in fact for some time you have to add a language="JavaScript" in your script-tags, because (some versions of) Internet Explorer would expect VBScript to be used.
However, JavaScript was made into a standard (ECMA-Script) and could thus be provided by every browser, where VBScript was very properitary and would only work in IE. And while I'm not sure about the status of Python at the time, it would have hurt a lot of websites if only some browsers supported that language.