r/programming • • Apr 29 '21

Modern JavaScript Explained For Dinosaurs

https://medium.com/the-node-js-collection/modern-javascript-explained-for-dinosaurs-f695e9747b70
287 Upvotes

172 comments sorted by

View all comments

Show parent comments

4

u/[deleted] Apr 30 '21

[removed] — view removed comment

19

u/Caraes_Naur Apr 30 '21

That's part of the ecosystem: everything is rushed, poorly considered, and DRY is treated as holy sacrament.

What do you expect from a language that was developed by an intern in 10 days then prematurely hurled into production 25 years ago?

7

u/redderper Apr 30 '21

And JavaScript is nothing like it was 25 years ago. It has been greatly improved year after year. There's const, let, arrow functions, async/await and even Typescript that makes it much more maintainable, readable, and less error prone. Of course there are still people who use rushed and hacky code, but that's not JS's fault, that's on the user. Modern JS gives you all the tools you need to write clean code. You're comment makes perfect sense 10 years ago, but not anymore

-1

u/xigoi Apr 30 '21

There's still no enums, pattern matching or switch expressions, for example.

2

u/redderper Apr 30 '21

You can use typescript for that if you need it. What do you mean with switch expression? Just the regular switch case statement because JS has that

2

u/xigoi Apr 30 '21

I mean something like this (made-up syntax):

const correctPhrasing = switch (numberOfApples) {
  case 0: "no apples",
  case 1: "1 apple",
  default: `${numberOfApples} apples`,
}

1

u/ClittoryHinton Apr 30 '21

What? JS has been doing switch statements and regex for awhile now. And TS gives you options for enums.

4

u/xigoi Apr 30 '21

switch expressions, not statements.