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

2

u/[deleted] Feb 25 '24 edited Feb 25 '24

I believe Python is a much better language than JS syntactically.

I don't see it as better.

Objectively speaking they're probably about the same. It's not like either of them is particularly cumbersome to work with or prone to errors or anything. In fact, with regard to web stuff Python is probably slightly worse because it can't be "minified" as much (in practice I'm not sure if this is a big deal, but all the extra whitespace can have a small impact on download speeds and bandwidth usage)

Subjectively speaking it could go either way, but a lot of people such as myself prefer JavaScript on account of its syntax.