JavaScript: The Recent Parts

Declarative JavaScript

Kyle Simpson

Kyle Simpson

You Don't Know JS
JavaScript: The Recent Parts

Check out a free preview of the full JavaScript: The Recent Parts course

The "Declarative JavaScript" Lesson is part of the full, JavaScript: The Recent Parts course featured in this preview video. Here's what you'd learn in this lesson:

Kyle explains why the changes that are coming to JavaScript make the language more declarative.


Transcript from the "Declarative JavaScript" Lesson

>> Kyle Simpson: As far as narratives go, I think that it's important for us to understand that it's not just a grab bag of whatever we can figure out that. That there are some important, larger narratives happening with the evolution of language and I think the most important of those is that JavaScript is moving in the direction of being a more declarative language.

Declarative as compared to imperative. Where declarative means we declare the outcome, the what, and we allow the abstractions of the language to handle the how, so, that the reader is focused more on the what, the outcome and even more importantly on the why. That makes code able to communicate better.

Generally speaking more declarative code communicates better. So for example, some of you probably know about the dot dot dot spread operator that was one of the features add in ES6. And the dot dot dot operator is replacing the very imperative equivalent of doing something like a dot apply or doing something like arguments that with arguments to try to erase slices I call with arguments to try to turn the argument's object into a real array.

So those are very imperative approaches to things, and then we got declarative approaches. It wasn't so much you could do a whole new thing, as it was you could do it in a much cleaner and more communicative way. And so that is an important narrative to understand. And as we go throughout this course, you are gonna see features that have varying degrees of imperativeness or declarativeness, but I think they do fit in this larger narrative which says, these are not necessarily things that no JavaScript developer has ever done before.

But rather, we've been hacking these sorts of things for years, and it's time for the language to support it, and in as clear, and concise, and communicable a way as possible. And so I'm excited about the future of JavaScript. It's bright, it's vibrant, there's lots of amazing things happening.

And quite frankly, it's good job security for me, because we're gonna continue to have lots of things to talk about. And you'll see that this course will have to get updated on a one or two-year basis, cuz there's gonna be new stuff that keeps landing in the language.

And that's a good and healthy thing.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now