I want to learn another programming language now that I’ve been using Python for over 2 years now. I am kind of leaning on learning JS so that I can use it for the backend and also for the frontend. But the syntax is kind of weird. I heard Go is pretty good for the backend and also is compiled. What do y’all say?
Go has a much cleaner syntax, and is better suited to its specific niche which is (relatively) low-level BE development. If you are attracted to that niche then Go is an excellent option. Also, Go is almost a default for developing for K8S, which might be another plus.
On the other hand, JS is a more general-use language. It has a very loosey-goosey syntax and lots of weird behaviors. It is applicable on both FE and BE but be aware that in each of those, knowing JS is just a first step, since (for example) for FE development you will also need to know at least one of the major frameworks (React, Vue, Angular etc) as well as the page object model and a ton of other stuff.
Bottom line- usually the language is the tool, not the objective. Figure out what you want to develop, then choose the optimal language to do it with.
MotoAsh@lemmy.world 1 year ago
JS will be far more versatile if you learn it well. It’s in so many dang things.
The biggest annoyances about JS are some things that exist in Python, so you’ll already be familiar with loosely typed systems and mutatable objects (dictionaries/hashes or what ever Python calls 'em).
Other than that, it’s mostly that there are a million ways to get the same things done, even something like, “define a class with static and instance-bound functions and properties”. Older JS techniques only use scope and the prototype and look like a gross hack. Modern JS has actual class syntax.
It all stems from the constant enhancement of the language. Many, many nice features like proper class syntax and first class modules (no more third party module syntax) came in ES2015, and a sadly small number of front end devs to this day really don’t know them well.
Many web dev tutorials use older style techniques just because they’ve been around ages. If you learn how the new features are mostly syntax sugar on old styles, you’ll be a JS pro in no time.
clif@lemmy.world 1 year ago
This is a great answer. Bumping it as someone who got forced to move into Node/JS around 8 years so and came to love it. It’s primarily what I work in and I teach community classes on it these days.
I’ve been dabbling in Go lately for lower level server side stuff and, while I don’t dislike it, it’s a big shift in thinking. There are a lot of niceties to the Go ecosystem.
Asudox@lemmy.world 1 year ago
I see. Do you perhaps have a tutorial that does use those new features?
Bartlebee@artemis.camp 1 year ago
Commenting to save the answer as well