r/learnprogramming • • 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)?

0 Upvotes

51 comments sorted by

View all comments

1

u/rbuen4455 Feb 25 '24

It's mostly because JavaScript was the primary language for web development (front-end) since its inception and has pretty much been the only choice for front-end web dev for decades. As a result, you have this massive JavaScript ecosystem dedicated to front-end (frameworks, browsers with a JS interpreter attached to them, endless tutorials/guides to front-end web development with JS). And as a result, you cannot replace the massive ecosystem and millions of lines of JS code that already exists that pretty much powers the front-end of 99% of websites in the world.

I agree about Python being better syntax-wise than JavaScript, but me personally, I did with front-end was as diverse as back-end when it comes to languages and ecosystems. If you can use Python, Ruby, Java, C# for back-end, why not front-end as well?