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? I also welcome other language recommendations.
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 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.
This is a great answer. Bumping it as someone who got forced to move into Node/JS around 8 years ago and came to love it (after the ES2015 changes :). 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.
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.
As someone else already said, don’t overthink the language choice aspect in general. If you learn almost any imperative language with C-like syntax (Go, JS/TS, C#, Java etc), picking up another one in the same “family” to a usable degree will be a very minor hiccup done within a very short time (hours). Sure, there are quirks and special syntax and different collections of built-in features for each one, but as a developer you will likely switch between several anyway and need to look up syntax from time to time - you know that something can be done, but the details how are a bit fuzzy.
For instance, I code mostly in C# and JS/TS, but we have legacy applications written in VB.NET so I often google VB syntax for things that I know how to write in C#. I also occasionally code in C, have dabbled in Fortran, Python and PHP and I’m sure I’m forgetting one or two. SQL and LINQ syntax too of course. What you learn on your developer journey is that something can be done, but remembering the specific implementation in a specific language might be a job better suited for your search engine. That said, of course it’s good to start with one language that you know pretty well, but it seems like you’re already there with Python.
The real challenge is learning the methodology of building applications, philosophy of OOP, patterns and program/application architecture and frameworks. Language choice is very much secondary to those areas of expertise imo.
Personally though, I am partial to JS/TS as I’ve used those the longest, they are extremely versatile and frontend development is my favorite area.
If you wanted to do both front and backend development TypeScript + JS/Node would make the most sense, no? I say this as someone who works with and enjoys working with Go almost every day, but there’s only so much time to learn new stuff.
I mean, I heard that new software engineers are allowed to work on the frontend first before the backend. So if I learnt JS now, I could master it, which would help me in the long run. Am I wrong?
Entirely depends on your skillset and company. That might be true somewhere, but seems strange.
I do recommend you pick up typescript though. It will forcibly teach you some good habits, expectations, and some more base understanding of what you’re actually doing.
Yeah, I was thinking of using TS anyways. I saw some video that showed how weird JS handles stuff when you try to add two things and such. I also want to make it a habit to type everything anyways. By the way, do I have to learn some more stuff if I want to use TS or is it just that it forces you to use types?
I can only say what I would do were I 20 years younger, and that is focus on Rust. I write a ton of Python, JS, and Go. Among them, Go is the most enjoyable and in my view has the best tool chain.
But Rust’s tools are even better. And it is very low level when desired, but you can still write even frontends with great wasm bindings and UI libs.
In the end, it doesn’t really matter. Just write.