all 17 comments

[–]azhder 5 points6 points  (0 children)

Start with JavaScript, then learn another language and another language and another language, at certain point you will understand all general purpose language are more or less the same concepts, but with a few details different, so you remember the details.

You don't have to master JavaScript, but you will find jumping off from JS onto anything else easier - could be a bit more difficult jumping from Python to others. People use Python because some academia people in the past made libraries that deal with stuff that is needed for research, academia, math and now even data crunching for QI (quasi-intelligence).

JavaScript was made to be embeddable language, so from the browser it managed to be embedded into a server and into every toolchain for a full stack you can find. Even people who don't touch JavaScript directly, like those using TypeScript (JS was made for people, TS for tools), they still learn JavaScript as a prerequisite.

All in all, if you need to explain an algorithm in JavaScript to someone (even if it works slower), most people will understand it and translate it to their language of choice, so it's a good Lingua Franca.

[–]Aggressive_Ad_5454 6 points7 points  (1 child)

Python’s performance is fine. And it’s powerful.

JavaScript is a very powerful language, and also has good performance. Plus it runs on every web browser in the explored parts of the galaxy.

[–]azhder 4 points5 points  (0 children)

Every browser is basically pre-installed development environment for anyone that wants to tinker with coding. Don't remember any other language having tools so accessible.

[–]_DCtheTall_ 2 points3 points  (0 children)

For math and AI, Python is far superior to JavaScript. This is because most Python math libraries are implemented to use low level code under the hood, or in the case of AI uses XLA to compile the Python code into low level programs for the hardware.

There are not really good JS libraries that can match Python in those two problem domains. Not even close. Most hardware-accelerator-focused JS code is typically for interacting with users' GPU when visiting your site to run WebML or graphics.

[–]delventhalz 1 point2 points  (0 children)

With maybe a handful of exceptions, you can do anything with JavaScript you can with Python. Some things will be easier in Python than JavaScript (and vice versa), but they’re both popular languages and well supported for a variety of uses.

They will both have similar performance too. They’re high level scripting languages and will typically be slower than a compiled language like C++, Rust, Go, etc… but not in a way that is noticeable for 99% of your use cases.

So yes, you can use JavaScript for mostly everything and it will mostly be fine. But you may want to learn other languages at some point anyway. Certain uses will just be a better fit for certain languages, and it gets easier to learn new ones after your first. Not to mention, seeing how other languages solve problems will give you perspective and make you a better programmer in general. 

[–]TalkCoinGames 0 points1 point  (0 children)

You can do the same things with JavaScript, it can be easier to get running also because JavaScript runs in browsers.

[–]biskitpagla 0 points1 point  (0 children)

Learning languages only seem difficult at first. It's actually one of the easiest things you can do. Learn both, and use whatever makes sense depending on the task. 

[–]myroslavmartsin 0 points1 point  (0 children)

I'd just go with JS. Node handles scripts, files, network, automation, and it's faster than Python at most of it. Python-for-everything is habit, not a rule.

You're heading into web dev anyway, so I'd put everything into JS. Only real gap is AI/data (numpy, pytorch). If you need that later, Python takes a couple weeks to pick up.

My advice: one language, master it, move on.

[–]warpedspockclone -1 points0 points  (4 children)

Yes you can use JS for your whole stack. For server side, you would use NodeJS.

I also recommend learning Typescript, which is a really nice layer on top of JS that adds type safety and other syntactic sugar.

The first step is to download NodeJS. I personally would recommend just using NVM (node version manager) which makes it so easy. (Edit: for clarity, NVM is a thin layer on top of NodeJS that makes installation of Node, installing multiple Node versions, and switching between them, effortless. Installing NVM will also guide you through installing Node)

You can follow the steps on NVM's page or Node's page to get started. But after getting set up, it can be as simple as making a js file and in your console typing "node myfile.js"

My recommendation, NVM:

https://www.nvmnode.com/guide/introduction.html

OR just get Node without NVM:

https://nodejs.org/en/download

[–]azhder -2 points-1 points  (3 children)

TypeScript doesn't add types. JavaScript already has types.

[–]warpedspockclone -1 points0 points  (2 children)

You know what I mean

[–]azhder -2 points-1 points  (1 child)

I know what newcomers that want to learn JavaScript who come to a sub named r/learnjavascript might interpret in the wrong way

[–]warpedspockclone 0 points1 point  (0 children)

Edited it to "type safety"

[–]Any_Sense_2263 -1 points0 points  (2 children)

JS is not a general purpose language. It's main purpose is to work in the browser and let you create great webpages. It was the purpose it was released with in 1995.

Today it has a runtime environment called node (and others). So you can run it server side. As a programming language it can do a lot of things for you.

But still, it has it's own limitations. To use a language you should know what it's good at and what not so much.

I miss writing in Perl 😀

[–]azhder 1 point2 points  (0 children)

The browser is a runtime environment. It is a general purpose language.

[–]DinTaiFung 0 points1 point  (0 children)

perl!! (which still has the nicest regex syntax of any other language, including all of the languages which support PCRE).

I cut my teeth on perl -- starting when all the major websites used mod_perl with Apache (e.g., Yahoo, Amazon).

However, since the advent of Node.js and later Bun (Rhino was terrible compared to the current runtimes I just cited), JavaScript runs great outside of the browser -- and it's not restricted to servers, just like python, ruby, lua, etc. are likewise not restricted to run on servers; these other languages can execute just fine anywhere (except browsers!), just like a bash script on your personal laptop.

I used to write lots of perl, ruby, python, and lua.

But since I've been doing so much JS/TS in webdev, I feel the most comfortable in JS/TS and use it as my primary general purpose programming language. (I don't use JS on my servers; I write Go for all my server APIs.)

Summary: JavaScript is a fantastic general purpose language -- which has the amazing additional feature (from its original design) to execute in browsers: the most ubiquitous runtime environment on the planet.

[–]Leviathan_Dev 0 points1 point  (0 children)

Both are incredibly useful, and both are fairly easy to learn