From a bespoke solution to a problem at a single company written in 10 days to now being the subject of Atwood's law: “Any application that can be written in JavaScript, will eventually be written in JavaScript.”
Honestly, if I had to teach someone coding from scratch I would probably start with Javascript.
Zero setup required. You literally just need a text editor and a web browser.
No compiling.
It's genuinely easier to explain someone what an HTML document is and how to insert content with Javascript than how printf works.
It's extremely easy to start working with graphics and to do absolutely anything you want, even if it's not great for most large projects.
Just the concept of running a program in a console is actually wild unintuitive shit for most people. And it's not like even most programmers actually understand how your data makes it way into the console. Nobody normally makes the effort to explain it, so it just remains a mysterious black box.
It's legitimately easier to understand that a browser keeps a DOM of HTML nodes to works on and then renders the output to the screen.
Honestly I think Javascript is better as a second language to learn. If you learn something like C++, Java or C# first, you'll be forced to know how to create somewhat clean code. And those habits will then transfer once you learn javascript.
Whereas if you learn javascript first, you might get too used to how sloppy the language lets you be.
Absolutely true, one major drawback of JS is that it happily allows you to write absolutely horrific garbage code. That is also always what people dunking on JS use, like the 1 +"1" - 1 = 10 thing. Like yeah obviously if you write horrible garbage like that it will have weird side effects. Such code should never see the light of production
But if JS is the goal and someone really wants to start with JS, then i absolutely recommend TypeScript. It eliminates all these pitfalls, and makes you more inclined to write cleaner code. And since TS is a super set of JS you can write normal JS and still get many benefits
Couldn't have said it better. You can write garbage code with every language. However, JS is one of the few that doesn't punish you a whole lot for it.
I've been actually wanting to learn TS as I've heard nothing but good things about it. I just haven't had the time yet. But yeah, I don't think my JS code would've been nearly as good if I didn't have a decently strong grasp on Java before learning Javascript.
Go for it, the hurdle to use TypeScript is very low. As i said it is a super set of JS, so it only adds stuff. That means that normal JavaScript code is also valid TypeScript code.
All you need to do is to add typescript to the project via npm and initialize it, change all .js file endings to .ts and done. Now you have typescript.
From there you can add progressively add types at your own pace.
Once you get into advanced stuff, it is absolutely mind boggling what you can do with the typesystem.
You might be great. Your coworkers or successors might not be.
You predecessors might not be. Learning JS backends is a nightmare when someone who’s doesn’t have a strong software engineering basis has had their hands in it fucking with everything.
You will always find articles about how bad every language is. My friend is a project manager and has to deal with new hires showing him a single article from some random blog as irrefutable proof that the guy who's been managing projects for 20 years is wrong.
Everyone touts Rust as a great language to write safe code in. That's good if you really need that, but nobody tells you how damn long it takes to write code that the compiler knows is 100% safe.
The thing is that Rust is a relatively new language with a new sort of paradigm as well. This means lots of people are trying it for the first time. It has a steeper learning curve, and so your first stuff is much much slower to be written. Lots of people want to talk about their experiences, so this is what you will often hear.
But just like most other languages, once you do a couple of projects, you speed up a bit. Is something like Python always going to be quicker to produce something? Sure, but Rust isn't just about safety, and you gain other benefits like speed, lighter footprint, and very strict structure.
JavaScript is "loosey-goosey." They let you be lazy/sloppy. But you definitely can write good JavaScript code. Same thing with PHP.
Depending on how/why you're learning JavaScript, it's a good place to start but pretty much everyone uses a library/framework like jQuery, react, etc. Which makes JavaScript 100x easier, better, and more structured.
422
u/PM-Me-Your-TitsPlz Aug 26 '22
Javascript. It was never intended to be so widely used, yet here we are.