What's New in JavaScript: Latest Language Updates and Features - JSJ 666
Hey, everyone. Welcome back to another exciting episode of JavaScript Jabber, part of the Top End Devs Network. I'm your host, Charles Max Wood, joined by our amazing panelist, Dan Shappir. In this episode, we dive into the latest developments in the world of JavaScript as we kick off a new year. You might recall we covered this topic about a year and a half ago in episode 590. Today, we're revisiting the updates to see what's progressed and what's newly introduced in the JavaScript standard.
Show Notes
Hey, everyone. Welcome back to another exciting episode of JavaScript Jabber, part of the Top End Devs Network. I'm your host, Charles Max Wood, joined by our amazing panelist, Dan Shappir. In this episode, we dive into the latest developments in the world of JavaScript as we kick off a new year. You might recall we covered this topic about a year and a half ago in episode 590. Today, we're revisiting the updates to see what's progressed and what's newly introduced in the JavaScript standard.
Dan Shappir offers his expertise as we explore features that have recently been added to the language. From promise.allSettled, a feature that's been around for about five years but often underutilized, to array method enhancements like .at and Object.hasOwn, there's a ton to unpack. We'll also delve into exciting new library additions like findLast for arrays, efficient array copying methods and improvements in set operations that make JavaScript more powerful and developer-friendly than ever.
The episode isn't just about the features that have already landed; we'll also touch on what's in the pipeline with proposals in various stages of development, including exciting concepts like temporal for better date and time handling. Whether you're a JavaScript pro or just keen to stay updated on the latest trends, this discussion is packed with insights to level up your coding game.
So, grab your headphones, stay tuned, and let's explore the exciting world of new JavaScript features together!
Links to things mentioned in the podcast episode:
Transcript
Charles Max Wood [00:00:05]:
Hey, folks. Welcome back to another episode of JavaScript Jabber. This week on our panel, we have Dan Shapiro.
Dan Shappir [00:00:12]:
Hello from Tel Aviv.
Charles Max Wood [00:00:14]:
And I'm Charles Max Wood from Top 10 Devs. This week, we're gonna be talking about what's new in JavaScript. It's a new year. There's a bunch of stuff that came out last year or so. And so, Dan was pointing them out to me, and, that's what we're gonna talk about today. So, Dan, I know you have a list. I don't have the list in front of me, so I will let you just I'm the man
Dan Shappir [00:00:37]:
of the list.
Charles Max Wood [00:00:38]:
Yeah. I'll I'll let you steer the ship, and I'll I'll I'll provide the color commentary.
Dan Shappir [00:00:45]:
Yeah. So it's been a while since we've spoken about what's new in in JavaScript. You know, everybody's talking about what's new in frameworks, what's new in CSS, what's new in HTML. But, JavaScript, you know, it there was this period in of time where things were coming out, you know, fast and furious, and then it seemed like everything kind of settled down. But turns out that, you know, new features are being introduced. So I thought it would be worthwhile to talk about it. We actually spoke about it, year and a half ago in episode 5 90, and it's interesting to contrast what has moved forward and, what hasn't. So first of all, for our listeners, for anybody who may not know, there's this thing which is the JavaScript standard, but it's not actually called JavaScript.
Dan Shappir [00:01:37]:
It's called ECMAScript instead, which, Brendan Eich, the creator of JavaScript, has likened to a skin disease.
Charles Max Wood [00:01:47]:
It's really easy to remember too. I mean, ECMAScript just rolled, you
Dan Shappir [00:01:51]:
know Roll. Yeah. Rolls off the tongue. ECMA is actually the ECMA International is a standards organization. It was originally the European Computer Manufacturers Association, but then they just decided that it's ECMA and, you know, not the credentials anymore. But the so why is this standard called ECMAScript rather than JavaScript? I mean, the fact that it's happens to be handled by the ECMA organization should not have changed the name of the language or at least the standard of the language. And the reason is that they don't have the copyright to the JavaScript name.
Charles Max Wood [00:02:32]:
Yeah, it's called trademark, technically, but yes.
Dan Shappir [00:02:34]:
Yeah. It's a trademark, and it's being held by Oracle. Oracle. Exactly. Yeah. The name escaped me all of a sudden. And it's a funny story because, if in case, you know, listeners don't know, they probably don't, JavaScript was created in by Brendan Eich in 10 days of glory back in 1995 while he was working at Netscape. Yeah.
Dan Shappir [00:02:59]:
But they were working in cooperation with Sun, which was this the the creators of Java. And they they had this kind of cooperation where JavaScript was supposed to be the scripting language in the browser, and Java was supposed to be the actual, you know, heavy duty programming language in the browser. That didn't happen, but what did happen was that Sun ended up with the JavaScript trademark.
Charles Max Wood [00:03:28]:
And then Because they own the trademark to Java.
Dan Shappir [00:03:31]:
To be honest, I'm not sure either because of that or because that was part of the deal of their cooperation with Netscape. Either way, they ended up with a trademark, and then they were bought by Oracle. So now Oracle holds that trademark, and they've literally done nothing with it. So there's this new movement now to actually free that trademark from Oracle. They've actually reached out to Oracle. They've reached out to the governmental body that's that's responsible for trademarks. There's an online petition that everybody can sign at javascript.tm fitting URL. I signed it, and I encourage our listeners to sign it.
Dan Shappir [00:04:13]:
And, hopefully, eventually, it will be released. This is actually being led by, Ryan Dahl from DNO, who we've interviewed a few months back. So he he wrote an interesting blog post about it. We can link to it. He gives the entire history and everything. I hope it's released, and we can finally call it JavaScript rather than ECMAScript. But be that as it may, that's the name of the standard, and it's being handled by a committee within ECMA called TC 39. And TC 39
Charles Max Wood [00:04:51]:
I was gonna say, if you're wondering what the cryptic name TC 39 is literally technical committee or something like that.
Dan Shappir [00:04:57]:
Exactly. It's technical committee 39. There are a whole bunch of technical committees within ECMA, and that's the number they got. And they have this whole process of how to introduce features into the JavaScript language. Mhmm. Originally, this process had forced 5 stages. Sorry. Stage 0 through 4 because, well, you know, everything should be 0 based.
Dan Shappir [00:05:23]:
Right. And but now they've actually added an interim stage, 2.7. So now they have 6 stages. And to run through them really quickly, stage 0 is basically it's a new proposal. It's not even really considered. Basically, you've had an idea and you've written down a note about it and sent it to the committee. That's more or less what stage 0 means. It's hardly anything, really.
Dan Shappir [00:05:52]:
But it's the starting point for all, proposals in that are processed by the committee. When the committee decides to actually look at a particular proposal, it moves to stage 1. That means that that proposal is under consideration. The committee expects to devote time examining and identifying the need for that proposal, what it's supposed to address or improve or fix, and basically compare it to other alternative solutions that might exist and decide whether it's worthwhile to pursue. They need to identify somebody to champion that proposal. They expect an outline to be written and so and discuss algorithms and abstractions and semantics and so forth, all the good stuff. So that's stage 1. Stage 2 is when the committee has chosen a preferred solution or maybe a few solutions in a in a particular solution space, but the design is very much still a draft and may change significantly before it's actually introduced into the the language.
Dan Shappir [00:07:12]:
The committee actually expects something to be developed and eventually introduced into the language. They're just not absolutely sure what it is yet and how exactly it's gonna look. And at that point, they expect, obviously, the thing to be much better documented, and, you know, for people to start experimenting with it and actually have something real to, examine. Now they've introduced a new stage called 2.7 because they they didn't wanna move stage 2 or stage 3, and they wanted to put something in between. So stage 2.7 means that the proposal is approved in principle and is currently undergoing validation. That means that, maybe a browser manufacturer has put it behind a feature flag, or maybe there's a a Babel plug in, or something like somebody is playing with it, experimenting it and with it, and, you can start seeing how it actually works and whether it actually feels like a good idea. Stage 3 is when the proposal has been recommended for implementation and no changes to the proposal are expected. In other words, they they feel pretty confident that this is how it's gonna be, but it's not yet part of the standard.
Dan Shappir [00:08:39]:
And, therefore, backward compatibility is not yet required, which means that if somebody comes up with a better idea or they come they suddenly discover a problem with it, they can backtrack. So they can even, you know, move it back to stage 2 or even 2 or 2.7, something like that. And, finally, you've got stage 4, which means that the proposal is feature complete and is ready to be included in the standard. Essentially, it means that it's effectively part of the standard, just that a new standard document has not yet been released. One is released once a year. So it, proposals that are complete wait at stage 4 until they are included in the next release standard. And, usually, by the time they're in stage 4, you actually find them implemented in browsers, and you can actually start using them. So far so good? Mhmm.
Charles Max Wood [00:09:42]:
Yeah. It's funny too because you're talking about this process and 2 things are going through my head. And one is it sounds complicated, but yeah. I mean, if you really think about the progression, it all makes sense. Right? The the other thing that's going through my head is, I'm we're currently heading into a legislative session in in the state of Utah. And so I've been going through the process that bills go through to get passed, and I was sitting here going I'm going, wow. This this is in some ways simpler and in some ways, more complicated than the political process.
Dan Shappir [00:10:21]:
In in certain ways, it has to be because unlike the political process, these kind of standards are really set in stone. When something is added into JavaScript, it can never really be removed Yeah. Which means that we had better be really certain about adding it into the standard. And you've got like I said, you've got the browser manufacturers on this committee, and they've got to really approve it and say, you know, this is something that we can actually implement. You know, somebody might have this great idea, but implementing it would turn JavaScript on its head, then, obviously, the the browser manufacturers will will push back and won't approve it. Yep. So let's put it this way. The the attitude is better safe than sorry, and that's a good attitude to have in the context of language standard, especially a language like JavaScript where, as I said, once something is added, it can never be removed.
Charles Max Wood [00:11:26]:
I I I really wish that our legislators would do better safe than sorry. Let's let's think a little more deeply about this before we pass it or not. Right? Anyway, but, yeah, I I I completely agree, and I think it's good context. The JavaScript has always gone way out of its way to be backward compatible. I'm sure there are some times where there was just something that they had to kind of roll back. But
Dan Shappir [00:11:53]:
Actually, the the one time that I can think of where effectively things were rolled back was when they introduced strict mode. And even then, they introduced they rolled them back by introducing strict mode. So if you're running outside strict mode, they're still there. They wanted to roll back, for example, the with keyword, and I won't get into the details of why. It turned out to be a bad idea in the context of the JavaScript programming language, but they couldn't remove it. And so instead, they kind of rolled it back by making strict mode more and more the common way in which JavaScript work and in strict mode with does not exist.
Charles Max Wood [00:12:40]:
Right. Yeah. And and if you're wondering if you're if you're newer to JavaScript and you're saying what what what is strict mode, don't worry about it. You're using strict mode.
Dan Shappir [00:12:51]:
Yeah. Just so you know, you know, it we mentioned it, so we might as well provide details. You can explicitly enter strict mode by having the use strict string at the top of a scope or the top of a file. You can't actually ever exit strict mode. You only enter strict mode. And you enter strict mode by default in, ECMAScript modules. So if you implement a module, it's strict mode by definition. In, HTML, that's if you have a script tag with a type equals module.
Dan Shappir [00:13:28]:
It's, it's strict mode by default, and then you can do module things like imports and stuff like that. You also strict mode by default in classes because, again, classes are kind of a new type of a scope, and it makes sense to be strict by default inside classes.
Charles Max Wood [00:13:45]:
Yeah. I think most people working within the context of JavaScript, though, they're they're working under some system that puts them in strict mode without them
Dan Shappir [00:13:53]:
Yeah. Because they're they're building they hopefully, they're building ECMAScript modules these days.
Charles Max Wood [00:13:59]:
Yeah. So your React projects or, you know, whatever other framework or library you're using generally use modules, and so you're generally put into this box anyway.
Dan Shappir [00:14:10]:
And I really can't think of any other occurrence where something was effectively removed out of JavaScript. Mhmm. So, you know, it's interesting. Yep. Anyway, so let's talk about a couple of these enhancements and proposals. But before we dive into them, it's really worthwhile to highlight the fact that none of them really significantly or maybe even at all change the JavaScript syntax or semantics. So you've got nothing new like the arrow function syntax or let or const or stuff like that, which really changed the way that JavaScript kind of worked. Well, there is one towards the end, but it's still, at stage 3.
Dan Shappir [00:15:00]:
And we'll see if we we make it all the way to that one. But all the rest can are better described as being part of a, quote, unquote, JavaScript standard library. They've added new object types, and new methods or functions that are built in that you can use instead of, let's say, importing some NPM module that would implement them. So we've got more standard functionality being provided out of the box by the JavaScript runtime environment itself, be it the browser or be it node or whatever.
Charles Max Wood [00:15:42]:
Yeah. So what I'm hearing is is that if you're using these you may be already be using these features. They're just now the official standard kind of stuff.
Dan Shappir [00:15:53]:
Yeah. You might have there's a good chance that you might have imported such functionality before. Now it's built in, and you don't need to import it anymore. Kind of like the browser started providing fetch as a built in, function, and you didn't need something like an axials anymore. Mhmm.
Charles Max Wood [00:16:12]:
Yep.
Dan Shappir [00:16:14]:
So the first one I would like to mention is something that's actually 5 years old. It's from ES 2020. And, it's called promise dot all settled. And it as it as its name implies, it waits for all prom this provided promises to be settled. Now, you know, it's very common when working with promises to need to wait on a couple of promises simultaneously, effectively in parallel. And when most developers need to do that, I see most of them reaching out for promise dot all and just using promise dot all. But what they might have not considered is the fact that promise dot all short circuits on a rejected promise. So promise dot all receives an array of promises, and it waits in parallel on all of them.
Dan Shappir [00:17:14]:
It returns a promise that resolves when all the provided promises resolve. But if even one of those promises reject, then the return promise immediately rejects. And that may not be what you're looking for. It may be, but it may not be. Sometimes, you actually want to wait on all the promises provided until they are all of them either resolved or rejected. In other words, all of them are settled, and hence, the name of the method, all settled. Right.
Charles Max Wood [00:17:53]:
So, let me see if I can restate this in a different way. So if you promised dot all yeah. You you if one of them rejects, you get rejected. But it doesn't yeah. But it doesn't tell you that they've all finished waiting for whatever it is that they're waiting for. And so, effectively, the all settles, it it does more or less the same thing. But if you have one of them that's still waiting for whatever, you know, whether it's gonna reject or fulfill or anything else
Dan Shappir [00:18:26]:
So think about a simple scenario. Let's say you have 2, promises. Sorry. Let's say even 3 promises. Mhmm. And you pass the area of the 3 promises into promise dot all. Let's say the first one, resolves. That's great.
Dan Shappir [00:18:43]:
And then the sec then the other 2 are still pending. And then the second one, rejects, then it will immediately return with a reject. It won't wait on the 3rd one to either resolve or reject, and it won't also tell you that the first one resolved. It will just tell you that, hey. This thing rejected.
Charles Max Wood [00:19:06]:
Okay.
Dan Shappir [00:19:07]:
Whereas with promise all settled, what you get back is an array of objects. First of all, it waits on all 3. So even if the second one rejected, it will still continue to wait until the third one completes. And then it will return an array of objects, and each object has a, a field that indicates whether or not it resolved or rejected. Mhmm. So, I I wanted to have this open, and I forgot.
Charles Max Wood [00:19:43]:
I just posted a link to MDN, and it Yeah.
Dan Shappir [00:19:46]:
MDN is always there. Yeah. MDN is always the best. So it basically returns, an array of objects, one for each promise. It had each element of those areas is an object with and it has a property called status, and that status could be either fulfilled or rejected. It has it if it's fulfilled, then it will have a field called value with the resolved value. And if it if it was rejected, it would have a field called reason with the, appropriate rejection reason. So this way, you can look at all the promises and see whether they resolved or rejected and what they actually returned.
Dan Shappir [00:20:30]:
And as I said, in a lot of cases, that's actually what you want rather than just promise dot all. But a lot of people are not familiar with it and use promise dot all when they should have actually used promise all settled.
Charles Max Wood [00:20:44]:
So MDN may makes it look like because it it calls promise dot all settled, you pass in the array, and then it calls dot then. So does it operate as a promise as well?
Dan Shappir [00:20:54]:
Yeah. Yeah. It returns a promise that resolves to that array of objects. Right.
Charles Max Wood [00:21:01]:
Yeah. I just wanted to, you know, clarify because you you said it returns that, but it does it it it's a promise that resolves to that array
Dan Shappir [00:21:10]:
of things.
Charles Max Wood [00:21:11]:
It goes. It has to wait for everything to finish.
Dan Shappir [00:21:15]:
Exactly.
Charles Max Wood [00:21:18]:
That's cool. So I I'm gonna ask another question that's not about all settled, but you said this is from 5 years ago. So when you say that we're talking about new things in JavaScript, are these things that are now generally implemented, or are these just things that, hey. These have passed in the last however long and people ought to know about them, or or what's your criteria for making the list?
Dan Shappir [00:21:45]:
Well, first of all, this this is the oldest one. Everything else that I'm gonna be talking about is newer than that. Mhmm. And I guess my criteria was relatively new things that our listeners might not have known about. Now I think that things that are actually already part of the standard are generally much more interesting that things that are not yet part of the standard. I mean, you know, things that are not part of the standard are might be really cool. Usually, they often push the envelope a lot more, which is one of the reasons that the committee is kind of hesitant about adding them actually into the language. But I think that when you've got the functionality that can actually be used and provides real value, that's more pertinent, let's say, than some pie in the sky that might never actually arrive.
Charles Max Wood [00:22:40]:
Right. So these are probably just hidden gems that you may not have known got added to the language.
Dan Shappir [00:22:48]:
Exactly. And, like, over the last 5 years, I guess. Yeah. K. The next one is from ES 2022. So it's it's almost 3 years old. And it's the dot at method on arrays, strings, and typed arrays. And you basically give it an index, and you get back the item.
Dan Shappir [00:23:12]:
So it's really like using the square brackets in a lot of ways. And you might ask yourself, well, why do I need it? Why don't I just use the square brackets? And the reason is that you can also provide it with negative numbers, and then you're indexing from the end. So if you do dot at on an array and pass in minus 1, you're looking at the last element in the array.
Charles Max Wood [00:23:40]:
Interesting.
Dan Shappir [00:23:42]:
Now that's actually how various other programming languages actually work. So in other programming languages, you might have been able to have the minus in indexes in the square brackets themselves, but you can't do that in JavaScript because that's not how named properties work in JavaScript. And in JavaScript, you could legally have a minus one property, so you couldn't use that. And the funny thing is that this negative index has actually worked with the dot slice method for a long time. Mhmm. But then it would always return an array. Right. And with dot at, you get that actual I element from the array, which is just nice.
Dan Shappir [00:24:30]:
Mhmm.
Charles Max Wood [00:24:31]:
Yeah. I've used other languages that do this with their array. So but they do it with the square brackets and yeah. You're you're explaining why you couldn't do that and maintain backward compatibility with JavaScript. But, yeah, this is this is really cool. I like that.
Dan Shappir [00:24:48]:
Another one that's more of a you should use and probably don't is object dot has own. Are you familiar with the has own property, method that so in JavaScript, you can there's the in operator, which tells you whether or not a property exists in an object. Objects in JavaScript kind of work like property bags, and you can check to see whether a particular string is the name of a property in the in an object using the in operator. But the in operator also looks up the prototype chain. So So it
Charles Max Wood [00:25:27]:
doesn't always say this this is cool. I just looked it up, and I am I've yeah. Anyway, go ahead.
Dan Shappir [00:25:34]:
Now has own property has existed forever as a way to check, whether a property name exists in an object without going up the property chain. The problem with hasOwnProperty is that not all objects necessarily have it because you need to, have the object prototype in your prototype chain to actually have it, and it's not there by definition. So you might try to use hasOwn property only to have it break because you're not actually your object doesn't actually derive from object prototype.
Charles Max Wood [00:26:15]:
Mhmm.
Dan Shappir [00:26:15]:
So the safer way is to do object dot hasOwn as this kind of a global method, static method. And the first parameter is the object you wanna test, and the second parameter is the name of the property you wanna check.
Charles Max Wood [00:26:32]:
Right.
Dan Shappir [00:26:32]:
So it's just a safer way. So the preferred way to check whether or not a specific object has a particular property is not using has own property, which is what most of us do, but rather using object dot has own. Yet I've don't recall ever seeing code actually work like that. So Right.
Charles Max Wood [00:26:55]:
So if you've this, for example, could tell you if you've overwritten a property. Right? You've written your own function for,
Dan Shappir [00:27:04]:
you know, a dictionary or whatever. Yeah. A lot of people use, JavaScript object objects as dictionaries. Mhmm. You know, ideally, I think they should be using the map object type. But a lot of people still like using, simple objects because, you know, it's easy to convert to from JSON and so forth. And you wanna check whether, let's say, a certain property exists in a JSON object or not. So you might use check it using hasOwn property.
Dan Shappir [00:27:36]:
You should actually check whether or not it exists using hasOwn.
Charles Max Wood [00:27:41]:
Mhmm. Gotcha.
Dan Shappir [00:27:45]:
So those are two things that were added almost 3 years ago in e s 2022 dot at and object has own. Relatively new, I guess, mostly not so much used, but they're there and they're useful. And I guess people should be using them more. Moving on. ES 2023. Here's a nice one that a lot of people, I think, might like, and this is find last on ARES. Sometimes you wanna find the last element matching a particular thing rather than the first. Now, obviously, you can do reverse and then find, but why reverse the entire array when you can just do find last?
Charles Max Wood [00:28:41]:
Nice. It's funny because I'm, I'm looking at the, oh, it does have find last in here, but it also had find last index of, which I guess is related, but not the same.
Dan Shappir [00:28:56]:
Yeah. Find and find last return the actual value. Find index of and find last index of return the index of the found element.
Charles Max Wood [00:29:08]:
Right. And this this finds a matching element. Right? So you can pass it a a function, and you can say if if this returns true on the element, then
Dan Shappir [00:29:17]:
Yeah. Let's say you want you have an area of numbers, and you want to find the first one bigger than 42. Right. So you can pass in a function that compares the x you know, you would do x and or
Charles Max Wood [00:29:29]:
x. 42. Yeah.
Dan Shappir [00:29:31]:
Exactly. And with find regular find, you would find the first element greater than 42. With find last, you simply find the last item greater than 42. Yep. And and like I said, usually what people would do is that they would reverse the array, and it's kind of silly to need to reverse just to find the last one.
Charles Max Wood [00:29:50]:
Right.
Dan Shappir [00:29:53]:
Speaking about reverse, the next things that I wanted to mention that came out in 2023 are the change array by copy. Again, talking about things that were in JavaScript that are a bit unfortunate but cannot be fixed because backward compatibility, we have certain methods that modify arrays in place. So, for example, if you do dot reverse on an array, it reverses the array in place. Likewise, if you do dot sort, it sorts the array in place. And that's not how we want to work in a more, quote, unquote, functional world. I guess they did it back in, 95 because for efficiency sake to avoid the extra locations. But you really I you know, it's you really want to avoid methods that modify objects in place if you can if you can avoid it. Mhmm.
Dan Shappir [00:30:56]:
So what they did is they introduced an alternatives well, not not an alternatives, alternatives to these methods, that create a copy. So instead of reverse, there's this new dot to reversed.
Charles Max Wood [00:31:15]:
Mhmm.
Dan Shappir [00:31:17]:
And to reverse does not modify the original array. Instead, it returns a new array, which is reversed. Likewise, you've got the dot to sorted, which, again, sorts an array, but rather than sorting in place, returns a new sorted copy. Right. And you should be using these. There's absolutely no reason. What I used to see are people copying the array by doing a dot slice and then doing a reverse on the copied array.
Charles Max Wood [00:31:56]:
Mhmm.
Dan Shappir [00:31:57]:
And now they can just do 2 reversed or 2 sorted. There's also there's also a too spliced, reminders. Splice, unlike slice, you it can be used to replace to delete parts of an array and replace parts of an array. Too spliced does that, but instead of modifying the original array, again, returns a modified copy. Yep.
Charles Max Wood [00:32:25]:
There's also a 2 sorted.
Dan Shappir [00:32:28]:
Yeah. I mentioned already the 2 sorted.
Charles Max Wood [00:32:30]:
Yep. And then there's dot width is the
Dan Shappir [00:32:33]:
other Yeah. The yeah. The dot width is confusing because it's kind of not 2 something. So where did this come from? Dot width is like dot at, but it modifies the copy. So, it modifies a particular item. You know, with dot at, you could change the value of a particular item. With dot with, you give an index and a new value, and it replay and it creates a copy where that particular element, you you know, with that index has the new value. So you might have an error rate, let's say, with 123, You do dot with 1 comma 42, so it will become 1423.
Charles Max Wood [00:33:19]:
Mhmm. Yep. And that I agree with you on the this should be your default way to move through arrays. I mean, we we run into these problems all the time where you inadvertently change something that you didn't intend to. And so by doing things in this way, you'll avoid those issues unless you explicitly want to be changing that for a for a real good reason.
Dan Shappir [00:33:46]:
Exactly. And especially because in JavaScript, when you pass arrays into, functions or methods, you're passing the reference to the array. Right. So you're actually, passing the reference to the original array. And if that method then or or function then calls dot reverse on the array that was provided to it because it needs a revert a reverse copy for some reason, but use reverse instead of to reverse, it not only modifies the array for itself, but also for whomever called it, which is totally unexpected behavior in most cases.
Charles Max Wood [00:34:25]:
Yep.
Dan Shappir [00:34:29]:
So yeah. For sure. Going forward, always use to reversed instead of reversed, to sorted instead of sorts, to spliced instead of splice, and dot with, whenever that makes sense. Continuing to move up the calendar, we're, you know, we are now in 2,025. Let's look 1 year back, 2024. We also got a couple of things. We got, top level await. And by top level, it means top level of a module.
Dan Shappir [00:35:06]:
So if you're creating an ECMAScript module, you can have a wait outside of a function body. In the past, you could only use a waits inside a sync functions. Now you can actually use a weights outside ins but at right at the global scope as it were, but only inside modules. You might use it to maybe import some sort of dynamic mode do some sort of dynamic module import or maybe get some configuration file or something like that. So you might want to do a fetch in order to get some configuration or something like that. But you really need to be careful with top level awaits because they block the module load. So if you've got 1 module waiting, importing a submodule and that submodule does a global await, then it blocks the module that imports it until that promise resolves. Is that clear?
Charles Max Wood [00:36:22]:
Mhmm. Yeah. There's there's a really good example on the proposal itself, and I posted a link to that, the t c 39 proposal, where, essentially, what they're doing is they're running the await within a function that's kind of the you create a function, and then you call the function is effectively what you're doing with the await in it. That's an async function, and they've done it with, an immediately invoked async function as well as just, a named function that they call that's an async function. But yeah. Yeah. I I can see where this could be a foot gun where you could shoot yourself in the foot doing this. Yeah.
Charles Max Wood [00:37:11]:
For sure. But but I can also see the utility in it. Right? It's like, in order for this module to do anything useful, I have to have this other thing.
Dan Shappir [00:37:20]:
Yeah. Without this data, I can't do anything. Yeah. So I really need to wait on that data before I can actually even finish loading.
Charles Max Wood [00:37:29]:
Right.
Dan Shappir [00:37:31]:
But, again, you should definitely be really careful about using top level await inside your actual code.
Charles Max Wood [00:37:39]:
Yeah. I definitely have a reason to be doing this.
Dan Shappir [00:37:45]:
The next ones I want to mention, and they're really useful functions and have been available in a lot of other languages and are provided by libraries like Lodash, is object dot group by and map dot group by. Let's start with object dot group by. With object dot group by, you provide an array of of stuff and a function that you invoke it, sorry, on, on an on a a a collection of items, and you also provide a callback function which returns strings that describe each item in the sequence, and then it groups the items based on the string value. It's kind of difficult to explain, but very often, we want to take a collection of stuff and group those things according to what they are. So, for example, I've got I might have, like, different types of different objects in an array, and they also all all of them have, let's say, a different type, which is a string. So I can group them according to that the value of their type property and have, a sub return one array of, all of all the objects of one type, another array of all the objects of another type. It's instead of having to filter again and again and again, I can do it in one go.
Charles Max Wood [00:39:16]:
Yeah. This is something that I use pretty frequently in other languages as well, but, the and there's a really good example on the MDM doc that I just posted. But, yeah, I mean, they give a list, asparagus, bananas, goat, cherries, and fish. They all have a type property of vegetable, fruit, or meat, and then it tells it to, group by type, essentially. And I'm not gonna read the syntax for you. You'll have to go look at it because it's hard to just read out. But, yeah, then it gives back an object that has properties of vegetables, fruit, and meat, and it's shoved those objects up underneath that. So, it makes it really easy to, like you said, not have to iterate over it a zillion times if you're just sorting things or handling things based on their type.
Dan Shappir [00:40:01]:
Exactly. Now the only difference really between object dot group by and map dot group by is whether or not the result is an object with the various fields or a map with the various entries. Some people would prefer to work with a map. Some people would prefer to work with an object, so they can use either object dot group by or map dot group by, but the algorithm is essentially exactly the same.
Charles Max Wood [00:40:26]:
Yeah. It's interesting too because the so the on MDM for map dot group by, it it hands it an array for the things that it's and it has the same list of things actually as object dot group by, but it hands it an array for the thing that it's sorting. And, yeah, it just gives back a map instead. So kind of interesting there.
Dan Shappir [00:40:56]:
Now the final one that I want to mention is one that's gonna make a lot of our listeners kind of groan because a lot of people have really wanted something like that and have written a lot of boilerplate code to effectively implement this functionality. And so it's kind of nice to have it now built in out of the box. But on the other hand, I'm I'm kind of worried that people will abuse it or misuse it. It's promise dot with resolvers. When we create a promise, only the promise can kind of resolve or reject itself. So you do new promise, you pass in a function to the constructor with, resolve and reject, and that function and the promise constructor invokes that function, and only that code has access to the resolve or reject. You can't resolve or reject a function a promise, sorry, from the outside. Now what people do when they do want to be able to resolve, reject a a method, promise from the outside is then they actually copy, resolve and reject into global variables outside the promise scope, and it kinds of it kinda feels wonky.
Dan Shappir [00:42:22]:
Are you following what I'm trying to describe? Not entirely. Let's say I have a promise, but I want to have some sort of an external event resolve it.
Charles Max Wood [00:42:36]:
Mhmm.
Dan Shappir [00:42:37]:
So I do a new promise, and I and I pass in, the function that gets the resolve, but I can't resolve it from inside the promise. I want to have just an access to that resolve to resolve it somewhere else. So I I copy the val the reference to the resolve and hand it over to somebody else. And then that somebody else can resolve me.
Charles Max Wood [00:43:04]:
Okay. Sounds complicated, but I think I understand. Let me see if I can restate it just so that I get it. So,
Dan Shappir [00:43:14]:
I have a promise.
Charles Max Wood [00:43:14]:
For whatever reason, I'm not gonna use the the default, you know, dot then to resolve or, you know, dot what are the other ones like? Dot dot error.
Dan Shappir [00:43:24]:
No. You're not it's not exactly correct. Let let's say you've got a a a you do a new promise, and you pass in a function with with the resolve and the and that gets resolve and reject. And then you take the resolve and put it in window dot resolve. And you take the reject and you put it in window dot reject. Okay. You can call window dot resolve to resolve that promise.
Charles Max Wood [00:43:49]:
Uh-huh.
Dan Shappir [00:43:50]:
So you're copying that resolve method out of the promise into somewhere else. In that in the case I just gave, it's doing into a glow effectively into a global
Charles Max Wood [00:44:00]:
Make it into a global.
Dan Shappir [00:44:01]:
Yeah. But you can also copy it into a a local variable in a in a scope. But
Charles Max Wood [00:44:06]:
you're just
Dan Shappir [00:44:07]:
copying it out of the promise. And I've seen a lot of instances where people needed to do that for some reason. They they want to be a they they have a promise, but they want to be able to just resolve it from somewhere else. Mhmm.
Charles Max Wood [00:44:25]:
I'm trying to think of why you would need to do this. But
Dan Shappir [00:44:31]:
there's there are good examples in the in the MDN, but I've seen a lot of of examples of such thing. I've even seen example of something like that within React's on code when they implement, the when they they kind of throw, promises to, to, do to in order to, implement suspense. So it it's implemented by throwing promises, and you need to be able to resolve those promises from the outside. So they also kind of hold on to the resolve and reject of the promises on the outside of on the outside of the promise itself.
Charles Max Wood [00:45:08]:
Okay.
Dan Shappir [00:45:10]:
So with resolvers actually does that for you in a kind of built in way. It re instead of returning a promise, it returns an object that has 3 properties. Property called promise, which is the promise, a property called resolve, which is the resolver function, and a property called reject, which is the rejector function.
Charles Max Wood [00:45:35]:
Okay.
Dan Shappir [00:45:36]:
So and you can, destruct the the return value and basically get the promise, get the resolver, and get the rejector.
Charles Max Wood [00:45:47]:
Right.
Dan Shappir [00:45:49]:
So in cases where you need this kind of functionality, and as I said, I've seen this pattern used a whole bunch of times, it's now much easier and cleaner to do it because it's built into the language itself.
Charles Max Wood [00:46:03]:
Okay. So from what I'm because I'm looking at the proposal as well now. So, essentially, what you do is you, yeah. You you pat you do promise with resolvers and it deconstructs the promise so that you just have references to the promise resolve and reject as as functions or objects. And then and then you can yeah. And then you can
Dan Shappir [00:46:27]:
is an object and resolve and reject our functions.
Charles Max Wood [00:46:30]:
Right. And so so then what I can do is I can I can basically, reference those wherever I need? So if I have something else that needs to resolve or reject the promise, it
Dan Shappir [00:46:45]:
it just calls it just call it can just call resolve or reject it directly.
Charles Max Wood [00:46:49]:
Yeah. It can just do it without having to, right, without having to do work some magic on the promise object to, you know, get it the internals or something like that.
Dan Shappir [00:46:59]:
Exactly. So it's a it's a convenience method. You can definitely write the code yourself, but it was just really ugly boilerplate code. I've seen it done lots of code bases that I've that I've looked at, and it's nice to have a cleaner alternative. But you should have a good reason to use it rather than use the regular func promise semantics.
Charles Max Wood [00:47:25]:
Mhmm. Yeah. It's funny because you were talking about people having implemented it. And on the TC 39 proposal, it's like existing implementations and it shows where React did it and Vue did it and Axios did it and TypeScript did it and Vee did it. Deno did
Dan Shappir [00:47:40]:
it. So Exactly. Exactly. And so now it's built in, and there's no reason for any of them to actually do it themselves.
Charles Max Wood [00:47:46]:
Yep. Makes sense.
Dan Shappir [00:47:49]:
Okay. Now we're kind of done with things that are already actually in the language. Let's look at things that are not yet officially part of any standard, but are stage 4.
Charles Max Wood [00:47:59]:
Stage no. They are stage 4.
Dan Shappir [00:48:01]:
Which means that they are effectively part of the standard, just that the standard the relevant standard has not been released yet. Now,
Charles Max Wood [00:48:10]:
funnily enough Hang on. So what does that mean? It means that the they've adopted the proposal, but they haven't rewritten ECMAScript standard to include them yet?
Dan Shappir [00:48:19]:
Exactly. They release the standard once a year. So they'll release ES 2025 sometimes later this year, but these things are kind of waiting for that document to be released.
Charles Max Wood [00:48:31]:
I gotcha. So so people might be furiously working away at them now because they know what's
Dan Shappir [00:48:37]:
going on. All of them are actually the the ones that I'm gonna mention are actually implemented in browsers.
Charles Max Wood [00:48:43]:
Oh, okay.
Dan Shappir [00:48:45]:
But but they're not because from the browser's manufacturer's perspective, they've they've arrived.
Charles Max Wood [00:48:52]:
Right.
Dan Shappir [00:48:53]:
So why wait for the document if we know that they are gonna be part of the document?
Charles Max Wood [00:48:58]:
Makes sense. Extra credit to the browsers.
Dan Shappir [00:49:02]:
Yes. Indeed. And the funny thing is that I've actually mentioned them in in that episode 5 90 a year and a half ago. Only then they were stage 3. So it took them a year and a half to progress to stage 4.
Charles Max Wood [00:49:18]:
Yeah. But, again, I like that they're being deliberate about it. So
Dan Shappir [00:49:22]:
Yeah. For sure. So the first one are set methods. Do you know the set object type in JavaScript? Have you used it? No. Set is kind of like, the the set in math. It's basically a collection type Oh, yes. Where something can either be part of the set or not part of the set.
Charles Max Wood [00:49:44]:
I thought you were talking about, like, an a method on object or something called set object type. But, no, the set yeah. I've
Dan Shappir [00:49:50]:
Yeah. You do new set. Exactly. New set, you pass in an an array of stuff to the constructor, and, then those things are in the set, and you can check whether something is in the set or not. You can add more stuff to the set or remove it from the set. But it's basically just to to check if something is a part of a Right. A collection or not. And they and the thing is, like, as I alluded, set is really similar to set in math, and there are a whole bunch of operators that you can apply on sets in math.
Dan Shappir [00:50:27]:
And it makes sense to have them on sets in JavaScript as well. So you've got, for example, union, which can take 2 sets and return a new set, which is the union of those 2 sets so that it contains all the items that are in each one of them. Now it's an union rather than a concatenation because everything is in a set either either 0 or one time. Right. So if it's a set of 1, 2, and another set of 2, 3, and you do a union, you get the set with 1, 2, 3.
Charles Max Wood [00:51:00]:
Right.
Dan Shappir [00:51:02]:
Likewise, you've got dot intersection, which can, create an intersection of 2 sets or dot difference, which, returns the difference between 2 sets. And, and these whole bunch of methods that have been introduced to sets and just makes working with sets, like working with mathematical sets, much cleaner and easier. I assume that they were there was probably more than 1 package package on NPM that implemented all this functionality. It's pretty straightforward to implement, but now it's built in. So you don't need those NPM packages anymore.
Charles Max Wood [00:51:40]:
Yep. Yeah. And it makes a lot of sense because, typically, when you're using because because other collection types, you know, dictionaries or arrays, you're you're usually using those to to hold all your data. And like you said, I like the way you put it where it's a math like the mathematical set. So this is you typically use sets for certain types of operations. And so if you need a a friendly and easy way to to do those kinds of operations, you can use sets.
Dan Shappir [00:52:10]:
Exactly. That's what sets are for. So so it's really nice to have those methods now built into the JavaScript programming language. It's not like this big revolution. It's not like arrow functions or, like, let's let's our cons, but it just makes JavaScript a nicer language out of the box.
Charles Max Wood [00:52:30]:
Yep. So sets are a new addition? They didn't?
Dan Shappir [00:52:33]:
Well, sets have been here for a long time. Sets were introduced with maps, I think, way back in ES, what's called ES 6 or ES 2015. So they've been here for, like, a decade. But, it's nice to have these operations on sets now part of the standard.
Charles Max Wood [00:52:53]:
Okay.
Dan Shappir [00:52:55]:
As I said previously, you had sets, but if you wanted to do these in operation like union, you would have kind of needed to implement it yourself. And it it wasn't difficult. You could spread the set into an array, then concaten the the the the 2 arrays and create a new set out of them. Right. And you would get the union, but a whole bunch of copying going on. So now you've got a a cleaner, more efficient implementation Mhmm. And certainly an alternative to bringing in yet another NPM package. Right.
Dan Shappir [00:53:29]:
The other thing that was stage 3 and now is released, and it's a bit more difficult to explain, are sync iterator helpers. So we've had episodes in the past, way back in 2021, where I actually gave I talked for 2 whole episodes about iterators and why I think they're great. And I think I might have been able to convince AJ for the duration of the episode, and then he immediately changed his mind once that episode was over. Those were episodes 468469 for those who are interested in the details of what iterators are and how they work. I won't go into too much detail. Basically, it means that we now have methods like dot map map or dot filter or dot reduce on iterators like we have them on, let's say, arrays. And the easiest way to explain how to use them is think of let's say I have an array of stuff, and I would do array dot, let's say map and then dot filter and then dot, reduce or something like that. Now I I can wrap the array itself in in something that in in something.
Dan Shappir [00:54:52]:
It's iterator dot from. So I do iterator with a capital I dot from on the array and then on the return value from that, I do the dot map dot filter dot reduce, etcetera. Now you might ask yourself, why would I do that and what's the difference? So first of all, it returns an iterator that rather than an array. So if I then want to actually get an array in result as a result, I need to actually spread it into an the result into an array. So you say, hey. This is actually even more work. I needed to do add an iterator from on the original array and then spread the result into an array and, you know, what's the upside of all this? Why why would I want to do all this stuff? There are a couple of reasons. First of all, iterator dot from is not just for arrays.
Dan Shappir [00:55:43]:
It's for anything that's iterable. So it means that if I now have a new collection type so for example, maps or sets in JavaScript, they are collections. They actually implement the for each, but they don't implement the filter. They don't implement a find. They don't implement a reduce. They don't implement, filter. So how do I how do I invoke those methods on those types of collections? What I would usually see people doing is either avoid using these collections if they needed these methods or, alternatively, copy them into arrays. And if you're gonna copy them into arrays, then you might as well have just used arrays.
Dan Shappir [00:56:32]:
So now I can apply iterator from to anything that that supports iterators, any collection type that supports iterators, and then I can use all these methods on that collection. So that's advantage number 1. I don't need to implement those methods directly on each and every collection type. I just need to implement iterators in the collection, and then I can use these methods on any collection type, be it a built in collection or one that I implement myself. Okay? So that's advantage number 1. Okay? Mhmm. The second advantage is that it avoids all the, intermediate arrays. When you do, dot map on an array, you get, as a result, the array of the of the map.
Dan Shappir [00:57:25]:
So when you do dot map dot filter dot whatever, you're getting a whole bunch of intermediate arrays that you're copying stuff from 1 to the next to the next to the next and so forth. With iterators, they don't create those intermediate arrays. They work, by doing lazy evaluation. You just get the results that you need. Only the computations that that are required without all the intermediate arrays. So they're actually they can actually be a lot more efficient in cases where you don't need all the values. Right. And I'm really happy that they're here because iterators have been kind of a dud feature in JavaScript because they lacked all these, helper functions.
Dan Shappir [00:58:15]:
Hopefully, now maybe they'll they'll get some more love from the JavaScript developing developer community. Time will tell. Maybe it's too late. I don't know. We'll see.
Charles Max Wood [00:58:27]:
Yeah. So so these are the async iterator helpers. Right?
Dan Shappir [00:58:32]:
No. These are the sync iterator helpers. Oh, just a second. The the the the sync iterator helpers are here. They exist in in browsers. You can already do iterator from inside Chrome, inside Safari Okay. Inside Firefox. But what we don't have yet are async iterator helpers.
Dan Shappir [00:58:55]:
They're stuck in stage 2, I think.
Charles Max Wood [00:58:57]:
Yes. They are. This one state says it's stage 4. So
Dan Shappir [00:59:02]:
Yeah. The sync ones are stage 4. The async ones are stuck in stage 2. They've been stuck there for a whole while. That's really unfortunate. Again, what's the difference between helpful. Yeah. And and if our listeners are interested in the difference between sync iterators and async iterators, they should listen to episode 469 where I explained the difference in detail.
Dan Shappir [00:59:28]:
The other thing that I wanted to mention, which is kind of here, are JSON modules. You can now import not only JavaScript, you can import JSON.
Charles Max Wood [00:59:43]:
I'm sorry. Say that again?
Dan Shappir [00:59:45]:
You know the JavaScript import command?
Charles Max Wood [00:59:48]:
Mhmm.
Dan Shappir [00:59:49]:
Well, you can now import not only JavaScript modules, you can import JSON files, and the result of the import is the JSON object.
Charles Max Wood [01:00:01]:
Oh, cool.
Dan Shappir [01:00:03]:
You just need to tell the import that you're importing a JSON. It it, you you basically tell it you assert that this is the type of what you're importing. Is that is that kind of clear? Mhmm.
Charles Max Wood [01:00:24]:
Yep. I'm just trying to find an example on the Internet, but that makes sense.
Dan Shappir [01:00:28]:
You you do you do import JSON from something dot JSON, and then at the end of that instruction, you add with open curly brackets, type, colon, JSON, close curly brackets.
Charles Max Wood [01:00:42]:
Oh, okay.
Dan Shappir [01:00:45]:
Theoretically, in the future, we might have other types. I don't know. Maybe we'll import CSS or text files or I don't know what. But for now, we've got it for JSON. Now why is this useful? Because, I mean, you could just do, a a fetch and then Yeah. Do a JSON parse. Why do we need to import? To be honest, it's more of a convenience than a necessity, but the convenience is that in a lot of cases, we use JSON as configuration. And it's really useful to be able to directly import such configurations into the code.
Dan Shappir [01:01:24]:
Yep. Think about, I don't know, a webpack configuration or something like that. Mhmm. So you're creating some sort of a of of a node based, utility, and that utility uses some sort of JSON configuration. And now you can just import that configuration at the top of your file and then just use that configuration. Because if that configuration is missing, there's really nothing that
Charles Max Wood [01:01:56]:
you can do. Yeah.
Dan Shappir [01:02:01]:
And it also works with dynamic imports, by the way. Oh, nice. So, yeah, it's it's it's again, it's not earth shaking, but it's really useful, I think, and it's nice to have it built into the language. Yeah. Well it's stage 4, so that means that it's here.
Charles Max Wood [01:02:20]:
Yeah. The the way I think about it is is you import all the things that are required to run your application. And, yeah, typically, that's gonna be other JavaScript files. But, yeah, the it makes sense, right, that you may have some setup data or whatever that you need in order for it to work. And so it's it's another requirement. It's just not code.
Dan Shappir [01:02:41]:
Exactly. It's a declarative way to load your configuration data into your code, basically. And you can be, certain that that config if that configuration fails to load, then your code fails to load. And if it successfully loads, then your code then gets to run with that configuration. It kind of blocks on that configuration. It doesn't proceed until that configuration is loaded. So it's not like I'm loading some configuration asynchronously. I need to wait for it or write code that waits for it or something like that.
Dan Shappir [01:03:17]:
I can just import it and and use and rely on the fact that, if I if I load it successfully, it means that I have this configuration data.
Charles Max Wood [01:03:27]:
Yep. Also, for the iterator conversation, I did post, episode 469 just so that people can go reference that if they want.
Dan Shappir [01:03:39]:
Yeah. Basically, they probably want to listen to both 468469 together, to be honest. Yeah. Since we're running short on time, I want to mention just one stage 3 standout. It's it's, being stage 3 means it's not yet here, so don't go try to use it. But you there are various existing ways for you to actually test implementation, either NPM modules that implement it or, you know, Babel plug ins or some stuff, something like that. It's, the temporal object, or temporal namespace, actually. It's a more accurate way to put it.
Dan Shappir [01:04:21]:
We all know that the JavaScript date object is pretty bad. It it has it has a lot of, problems and limitations with it.
Charles Max Wood [01:04:35]:
I've I've done hand to hand combat with it before, and I have lost some of those battles.
Dan Shappir [01:04:43]:
Yeah. There are problems around working with the time zones with it. It only really supports your own your own time zone, And doing all sorts of daylight saving time computation is really challenging, and it and it's mutable, which makes it really problematic. It's it's it was created back in, in, 1995 based on the Java, the then Java date object. Java actually fixed their date object, but in JavaScript, you couldn't for backward compatibility reasons, so we are stuck with it.
Charles Max Wood [01:05:20]:
Mhmm.
Dan Shappir [01:05:21]:
So so temporal aims to fix this these problems by providing an alternative to date. So date will still be there because, obviously, you can't take something away. But now instead, you can use temporal. And by using temporal, you'll avoid the need for stuff like moment. Js and other, NPM modules, which aim to fix a lot of the time problems that we that we face when we need to deal with date and time in JavaScript. Yep. Other thing it supports non Gregorian calendars for people who care about these things. For example, the Hebrew calendar, you've got more, date format parsing of options, so on and so forth.
Dan Shappir [01:06:05]:
Just adds a whole bunch of functionality for dealing with date and time in JavaScript. Now as I said, unfortunately, it's still stuck in stage 3. I guess it's really complicated to get everything right in such a complex, complex domain, so they're taking their time. Hopefully, we'll get it eventually.
Charles Max Wood [01:06:25]:
Yeah. I was gonna say I as fraught as time and time zone and all of that stuff gets, and it's not just JavaScript. I I know that the we have some listeners that are kinda polyglot folks, so they work on the back end in Ruby or Rust or Go or something. Right? And so so you folks know that, hey. Some some of this stuff is maybe easier in that language, but it's still hard, sometimes. And then the folks that only do JavaScript like this is, it's it's a hard problem. And so, yeah, I understand why, yeah, they may be working through some of the finer details, to make sure that they get it right. Because, yeah, if if they put in an implementation that really does kinda just shine, I mean, that that's a big area of pain that a lot of people have to deal with.
Charles Max Wood [01:07:22]:
Now you said it's stage 3. So is it implemented or somewhat implemented or partially implemented in browsers?
Dan Shappir [01:07:29]:
No. It's not really implemented in browsers as far as I can tell.
Charles Max Wood [01:07:32]:
Okay. They do have some polyfills that are listed in the proposal?
Dan Shappir [01:07:36]:
Oh, yeah. For sure. It's it's an object in JavaScript. It's a namespace in JavaScript, so you can definitely polyfill it. There's, but, you know, some of these polyfill first of all, I I haven't checked how complete these polyfields are. And,
Charles Max Wood [01:07:53]:
the Yeah. The read me says so it was updated. Oh, that's helpful. It says it was updated last year. Very, very helpful. It does list other changes 2 months 4 months ago, so it might be longer ago than that. But the 2 that it lists are at jstemporal/ polyfill, which I'm assuming is an NPM package, and that says that the alpha release is available. And then temporal dash polyfill, which is a full calendar, implementation is it says the beta release is available.
Charles Max Wood [01:08:27]:
So it might be worth looking at, but, yeah, it it doesn't look like any of these are entirely stable.
Dan Shappir [01:08:36]:
Now we've effectively run out of time. I was going to talk about 2 more. One, one is the explicit resource management with the using keyword. It's this one actually does modify JavaScript semantics. I did actually discuss it, way back in episode 5 90, a year and a half ago. It was stage 3 then. It's still stage 3 now. So, the the one interesting thing is that TypeScript actually added it in, version 5.2 about a year and a half ago.
Dan Shappir [01:09:15]:
So it seems that, TypeScript kind of jumped the gun on that one. They saw it in stage 3. They assumed it was gonna be released soon, and so they added support for it and but it's not here yet. So it exists in TypeScript, but not in JavaScript, which is amusing.
Charles Max Wood [01:09:32]:
Yep. I just posted a link to that episode as well.
Dan Shappir [01:09:35]:
Yeah. And the other one is something with this really cool name called Shadow Realm. I guess we'll need to find a different episode to talk about that one. It's that one is currently in stage 2.7, which means it's not even stage 3. But it's
Charles Max Wood [01:09:52]:
Sounds good.
Dan Shappir [01:09:53]:
Yeah. You know, one of the things that I've been thinking about, and maybe if we get, requests from our audience to do it, is to do another episode about JavaScript features stuck in purgatory. There there are whole bunch of really yeah. There are whole bunch of really interesting JavaScript features that have been staged to for, like, what feels like forever. I wonder if it's worthwhile to actually even talk about them. Because on the one hand, they're some of them are really cool and really interesting, and they add a lot of really interesting twists to the JavaScript language. But on the other hand, seems like they're they're just they they're just stuck there. So the committee is not really doing away with them, but they're also not progressing them.
Dan Shappir [01:10:42]:
They're so they're kinda stuck. I wonder if it's worthwhile to even talk about them. What do you think? I
Charles Max Wood [01:10:48]:
think that would definitely be interesting. It it's also interesting sometimes the how do how do I put it? There are things that kind of flowed out there for a while. I'll go back to the the legislative example. Right? Because I mentioned, you know, laws passing and bills passing and stuff. There are things that get proposed, like, every year that just never quite get enough traction. And sometimes what's needed is somebody just points it out, and then all of a sudden some energy comes up behind it and and things move. And so, I'm imagining that, you know, I don't know that we have that bit that kind of influence necessarily, but it could start the process so that other folks start talking about it too. And we we get some exposure as far as, oh, this really is a good idea, and we ought to just go and finish it.
Charles Max Wood [01:11:39]:
Right? Whether that's, maybe we modify it to solve some of the concerns or, you know, there's a little bit more work put into just, you know, putting the polish on it or whatever, and then we get another cool thing in JavaScript.
Dan Shappir [01:11:53]:
Yeah. And I would imagine that AJ would be really happy that they're not here yet or not here maybe forever.
Charles Max Wood [01:12:02]:
Yeah. Well, cool. Well, yeah, I mean, all of this stuff's really, really fascinating, and I'm I'm looking forward to hopefully seeing more and more people use some of these features.
Dan Shappir [01:12:12]:
Yeah. All the features that we spoke about today are effectively in the language. So there is there is absolutely no reason not to use them. And in fact, as I explained, in some cases, it's preferably preferable to use them rather than the alternatives. So as an example again, instead of dot reverse, use to reversed. That's like a prime example of of, something that we should use. Or another one, if you're doing all sorts of mathematical operations with unions, then maybe instead of using some NPM, package, you just use what's now built into the JavaScript language itself.
Charles Max Wood [01:12:51]:
Yep. So I did a search on Shadow Realm, and it looks like there's a a twilight, something twilight. I think it's d and d book that's called Shadow Realm. And then, there were, like, 8 18 of the front page links were Yu Gi Oh,
Dan Shappir [01:13:11]:
the
Charles Max Wood [01:13:12]:
card game. So
Dan Shappir [01:13:13]:
In other words, it it must be a cool JavaScript feature if it's called Shadow Realm. I mean, you have to admit the name is really cool.
Charles Max Wood [01:13:21]:
Yep. So, anyway but, yeah, I I'd love to dive into some of these features. Yeah. Some of the ones that are in limbo or purgatory or whatever you wanna call it. Yeah. But it's also good to just see some of this stuff come along. And like you said, none of these are huge changes, but some of these sure seem like they'd make my coding either more stable or easier to do. And so I'm I'm all about that.
Charles Max Wood [01:13:49]:
So, alright, well, let's go ahead and do our picks. Do you wanna do picks first, or do you want me to go first?
Dan Shappir [01:13:55]:
I can go first. Alright. So first of all, people who are listening might have noticed that I've got a bit of a head cold and a stuffy nose. Hopefully, that goes away. So my first pick would be for my head cold to go away. Mhmm. Yeah. It's not really such a huge bother.
Dan Shappir [01:14:11]:
It's just annoying. So that would be my first pick. My second pick is we actually had a fun day to day at work. We are the the team that I'm mostly working with. We went out together to do to play laser tag, which was a whole was was a lot of fun. So my second pick would be to have fun days as team building exercises. And the 3rd pick would be to do a laser tag game because it's just fun. And those would be my picks for today, short and sweet.
Charles Max Wood [01:14:42]:
Yep. Laser tag is fun. I'm gonna pick it's it's a second version of a board game I've picked in the past. So I've picked Machi Koro in the past, and, essentially, just to give you an overview of Machi Koro, essentially, you're building a town, You buy buildings, and then you roll dice, and you get money based on whether it's somebody else's team or your team and whether you have a card with that number on it. And then you buy landmarks, and once you've built all 4 landmarks, you win. That's Machi Koro. Machi Koro 2 is a little bit different. So instead of building 4 landmarks, you only have to build 3.
Charles Max Wood [01:15:29]:
But the other thing is is that in Machi Koro, you put out all the different types of buildings you can build in your in your town. In Machi Koro 2, what you do is you have decks of cards that have numbers 1 through 6, decks of cards that have numbers 7 through 12, and then you have landmarks. And so you flip cards over until you have basically 5 unique buildings in each row, and then you you win when you build 3 landmarks. And so you play the rest of the game plays the same. You roll the dice. If you have the building, you get paid. The landmarks in Machi Koro, the original have fixed pricing for each landmark. In Machi Koro 2.
Charles Max Wood [01:16:14]:
Your first landmark has a cost. Your second landmark has a cost. Your third landmark has a cost, and those costs are on the card. I mean, those are the only differences. The rest of the gameplay is the same. It does give you a little bit more variety, and it makes the strategy just slightly a little bit more you really have to think about it a little extra in order to get what you want, because the cards do give you different abilities, But it's not such a wide breadth of abilities that you're going, oh, man. I don't know how to figure this game out. So, we played it with, some friends of ours.
Charles Max Wood [01:16:51]:
We got it for Christmas. My family did. And it's board game geek has a weight of 1.48, so it's a it's still a pretty simple game. I think Machi Koro is, like, 1.3. It's so, yeah, very, very approachable, simple game. Says age 10 plus can play it. My daughter's 9. I think she'd be fine playing this game.
Charles Max Wood [01:17:12]:
It says play time is 45 minutes. I'm not sure if I remember how long it took us. Probably about that long. So, anyway, it's it's a fun game. If you're looking for just something short, not terribly, complicated that you can play and kinda chat over the table while you play it.
Dan Shappir [01:17:31]:
Chuck, I'm kind of curious since you're such a board game geek slash expert. If you had to name your, like, top board game or at least one of your top board games, just out of curiosity, what would that be? 1 in the top 3 or top 5, please. So
Charles Max Wood [01:17:53]:
that's a little bit tricky just because there's so many kinds of board games.
Dan Shappir [01:17:58]:
Yeah. But there must be something you really like.
Charles Max Wood [01:18:02]:
So the ones that I've been playing a bunch lately, and I can I can give you a couple of them? I've already picked them on the show. No. Obviously.
Dan Shappir [01:18:11]:
I'm just curious which one you like the most.
Charles Max Wood [01:18:16]:
I'd really have to think about that. Like I said, the ones that we've been playing lately that we're really liking are Mysterium. We got expansion for that. It doesn't change the gameplay at all. It's just more cards. We got 2 expansions. The other one that we've been playing lately is betrayal at House on the Hill. I should put links to these in here.
Charles Max Wood [01:18:39]:
And that one's a fun one. It's it's relatively fast too, but it's more of a a role play game almost. The idea is you have your group of people that come into a haunted house, and you explore the house, and eventually a haunting happens, and you then you're trying to complete goals. One of you frequently becomes the trader almost always, not always, but almost always. 1 of you becomes a trader and then everybody's playing against that other player. And those the the thing that's fun about it is that the scenario you wind up playing changes from game to game. And so it's it's and the the as you explore a room, you place tiles for the rooms, and so your map changes every game too. And so there's there's a lot to like about that.
Charles Max Wood [01:19:32]:
Honestly, sometimes I really, really like the kind of the the thinker games. I'm not so some of the big big ones that people tend to like that I'm, I'm not a fan of are, like, 7 wonders or there are some of them where you're almost playing your own game, and then at the end, you see who played it the best. But you do interact with each other as far as did I do better at you with this than that. But then you've got other games. I'm trying to think. We've been playing risk legacy, which I like, but I don't love, with my friends. We played heat, and I think
Dan Shappir [01:20:16]:
I meant that risk is that play properly. It can take such a long time.
Charles Max Wood [01:20:20]:
Yeah. And we're getting to the stage with risk legacy. So risk legacy modifies the board every time and has special rules for how you win, and so it doesn't take as long. But the last time we played it, it's starting to get to the point where you really almost have to do world domination to win the round, and so it does take quite a bit longer. Yeah. I tend to like Settlers of Catan, that was one of the games that I kind of got into gaming board gaming on, but anymore, it's like, there are so many games that just have better mechanisms in them. And so, yeah.
Dan Shappir [01:21:01]:
If if somebody likes Catan and wants a better alternative, what would you recommend? Well, you need to think about it.
Charles Max Wood [01:21:10]:
Yeah. I do. Let let me I'll I'll I'll come back next time with my top 2 or 3 games.
Dan Shappir [01:21:16]:
That'll be your homework for next time.
Charles Max Wood [01:21:18]:
Yeah. But I will tell you that, yes, for the social games, we're we're really liking Mysterium. If you want a lighter, social game, things like Sushi Go Party are fun. If you're if you're looking at, like, maps and things like that, I mean, there are games out there. I kinda have this nostalgic feel for, access and allies, but that's another one that takes, like, 3 or 4 hours to play. Yeah. There there are a bunch of good ones out there. Let me think about that, and I'll come back to it.
Charles Max Wood [01:21:54]:
But To
Dan Shappir [01:21:54]:
be honest, I don't see myself playing a board game for 6
Charles Max Wood [01:21:59]:
hours. Yeah. The ones that I like, they take you about an hour and a half, and you have some idea about where you're at as far as, like, am I winning or not? But you don't entirely know because there's always some twist that you know? And so somebody could be building towards something, and you don't really see it until they resolve it. And then you go, oh, wow. Right? But then you turn around and you resolve your thing on the next turn, and then everybody goes, oh, now he's you know? So so those are the kinds that I like and the ones where I I have enough room to get creative on on the strategy. Right? Where there's not just kind of a tried and true, if you do this every time, you're gonna win.
Dan Shappir [01:22:42]:
Play go.
Charles Max Wood [01:22:44]:
Yeah. Go is a a good example of that, with fairly simple rules. So, anyway, other pics, my wife and I started watching Prison Break, which is an older TV show on Netflix.
Dan Shappir [01:23:04]:
That's an older that's on the nineties, I think.
Charles Max Wood [01:23:07]:
I think it's early 2000, but still, yeah, I've been liking that. I'm still watching. I have the last season of, what's it called? Reacher? No. Not Reacher. Jack Ryan. I've been watching that.
Dan Shappir [01:23:25]:
Yeah. I I tried to watch it. I couldn't really get into it. I I actually read some of the what what's his name? Clancy, I think he Uh-huh. Yeah. I read some of
Charles Max Wood [01:23:34]:
the books?
Dan Shappir [01:23:35]:
Yeah. I read some of the Tom Clancy books. I could never actually get into either the movies or the TV shows. I don't know. Yeah.
Charles Max Wood [01:23:43]:
They're older movies too. Hunt for Red October is a terrific book. Yeah. That's for sure.
Dan Shappir [01:23:49]:
That that's his best one, I think.
Charles Max Wood [01:23:51]:
Yeah. I've I've read a few, others of his books, but, the TV show is not based on any of the books.
Dan Shappir [01:24:00]:
Oh, yeah. I forget.
Charles Max Wood [01:24:01]:
They just pulled some of the characters out, and they basically have a new threat every season. That said, it's not the best ever kind of action spy TV show that I've ever seen, but I'm enjoying it.
Dan Shappir [01:24:17]:
If you've got Peacock, I would I I actually picked it a while back, but it might be nice for you to watch if if you've got Peacock. I don't know who has Peacock, but I do. Maybe. Then it's, Day of the Jackal.
Charles Max Wood [01:24:30]:
Yeah. You recommended that a few weeks ago, and that's kind of on my list. But yeah. Anyway, so I've been watching that. I'm in the middle right now, and I'm gonna pick these books again. I'm on book, like, 9 or 10 of the sort of truth books, and they they are so good. I I I've gotten so I read them in high school, and then I hadn't really touched them again. And so and he put out more books.
Charles Max Wood [01:25:01]:
The author had passed away a few years ago, but he he wrote, like, these good books and this yeah.
Dan Shappir [01:25:08]:
I recall reading some of his stuff. I'm trying to remember what. Yeah.
Charles Max Wood [01:25:15]:
Those were his
Dan Shappir [01:25:16]:
passed away.
Charles Max Wood [01:25:17]:
Big series. But, yeah, I, Yeah.
Dan Shappir [01:25:20]:
I see. He died, 5 years ago. 2020. Yeah.
Charles Max Wood [01:25:24]:
But, anyway, he's I've just been really, really enjoying these books. And so, yeah, I'll pick those as well. I don't know. I'm kind of rambling at this point because you derailed me with the question about board games. But, yeah. And then, just working on getting, JavaScript geniuses and the AI boot camp roll it out. So, yeah. Anyway, I guess we'll wrap it up because I am not going to keep rambling about this stuff.
Charles Max Wood [01:25:59]:
But, yeah. Till next time folks. Max out.
Hey, folks. Welcome back to another episode of JavaScript Jabber. This week on our panel, we have Dan Shapiro.
Dan Shappir [00:00:12]:
Hello from Tel Aviv.
Charles Max Wood [00:00:14]:
And I'm Charles Max Wood from Top 10 Devs. This week, we're gonna be talking about what's new in JavaScript. It's a new year. There's a bunch of stuff that came out last year or so. And so, Dan was pointing them out to me, and, that's what we're gonna talk about today. So, Dan, I know you have a list. I don't have the list in front of me, so I will let you just I'm the man
Dan Shappir [00:00:37]:
of the list.
Charles Max Wood [00:00:38]:
Yeah. I'll I'll let you steer the ship, and I'll I'll I'll provide the color commentary.
Dan Shappir [00:00:45]:
Yeah. So it's been a while since we've spoken about what's new in in JavaScript. You know, everybody's talking about what's new in frameworks, what's new in CSS, what's new in HTML. But, JavaScript, you know, it there was this period in of time where things were coming out, you know, fast and furious, and then it seemed like everything kind of settled down. But turns out that, you know, new features are being introduced. So I thought it would be worthwhile to talk about it. We actually spoke about it, year and a half ago in episode 5 90, and it's interesting to contrast what has moved forward and, what hasn't. So first of all, for our listeners, for anybody who may not know, there's this thing which is the JavaScript standard, but it's not actually called JavaScript.
Dan Shappir [00:01:37]:
It's called ECMAScript instead, which, Brendan Eich, the creator of JavaScript, has likened to a skin disease.
Charles Max Wood [00:01:47]:
It's really easy to remember too. I mean, ECMAScript just rolled, you
Dan Shappir [00:01:51]:
know Roll. Yeah. Rolls off the tongue. ECMA is actually the ECMA International is a standards organization. It was originally the European Computer Manufacturers Association, but then they just decided that it's ECMA and, you know, not the credentials anymore. But the so why is this standard called ECMAScript rather than JavaScript? I mean, the fact that it's happens to be handled by the ECMA organization should not have changed the name of the language or at least the standard of the language. And the reason is that they don't have the copyright to the JavaScript name.
Charles Max Wood [00:02:32]:
Yeah, it's called trademark, technically, but yes.
Dan Shappir [00:02:34]:
Yeah. It's a trademark, and it's being held by Oracle. Oracle. Exactly. Yeah. The name escaped me all of a sudden. And it's a funny story because, if in case, you know, listeners don't know, they probably don't, JavaScript was created in by Brendan Eich in 10 days of glory back in 1995 while he was working at Netscape. Yeah.
Dan Shappir [00:02:59]:
But they were working in cooperation with Sun, which was this the the creators of Java. And they they had this kind of cooperation where JavaScript was supposed to be the scripting language in the browser, and Java was supposed to be the actual, you know, heavy duty programming language in the browser. That didn't happen, but what did happen was that Sun ended up with the JavaScript trademark.
Charles Max Wood [00:03:28]:
And then Because they own the trademark to Java.
Dan Shappir [00:03:31]:
To be honest, I'm not sure either because of that or because that was part of the deal of their cooperation with Netscape. Either way, they ended up with a trademark, and then they were bought by Oracle. So now Oracle holds that trademark, and they've literally done nothing with it. So there's this new movement now to actually free that trademark from Oracle. They've actually reached out to Oracle. They've reached out to the governmental body that's that's responsible for trademarks. There's an online petition that everybody can sign at javascript.tm fitting URL. I signed it, and I encourage our listeners to sign it.
Dan Shappir [00:04:13]:
And, hopefully, eventually, it will be released. This is actually being led by, Ryan Dahl from DNO, who we've interviewed a few months back. So he he wrote an interesting blog post about it. We can link to it. He gives the entire history and everything. I hope it's released, and we can finally call it JavaScript rather than ECMAScript. But be that as it may, that's the name of the standard, and it's being handled by a committee within ECMA called TC 39. And TC 39
Charles Max Wood [00:04:51]:
I was gonna say, if you're wondering what the cryptic name TC 39 is literally technical committee or something like that.
Dan Shappir [00:04:57]:
Exactly. It's technical committee 39. There are a whole bunch of technical committees within ECMA, and that's the number they got. And they have this whole process of how to introduce features into the JavaScript language. Mhmm. Originally, this process had forced 5 stages. Sorry. Stage 0 through 4 because, well, you know, everything should be 0 based.
Dan Shappir [00:05:23]:
Right. And but now they've actually added an interim stage, 2.7. So now they have 6 stages. And to run through them really quickly, stage 0 is basically it's a new proposal. It's not even really considered. Basically, you've had an idea and you've written down a note about it and sent it to the committee. That's more or less what stage 0 means. It's hardly anything, really.
Dan Shappir [00:05:52]:
But it's the starting point for all, proposals in that are processed by the committee. When the committee decides to actually look at a particular proposal, it moves to stage 1. That means that that proposal is under consideration. The committee expects to devote time examining and identifying the need for that proposal, what it's supposed to address or improve or fix, and basically compare it to other alternative solutions that might exist and decide whether it's worthwhile to pursue. They need to identify somebody to champion that proposal. They expect an outline to be written and so and discuss algorithms and abstractions and semantics and so forth, all the good stuff. So that's stage 1. Stage 2 is when the committee has chosen a preferred solution or maybe a few solutions in a in a particular solution space, but the design is very much still a draft and may change significantly before it's actually introduced into the the language.
Dan Shappir [00:07:12]:
The committee actually expects something to be developed and eventually introduced into the language. They're just not absolutely sure what it is yet and how exactly it's gonna look. And at that point, they expect, obviously, the thing to be much better documented, and, you know, for people to start experimenting with it and actually have something real to, examine. Now they've introduced a new stage called 2.7 because they they didn't wanna move stage 2 or stage 3, and they wanted to put something in between. So stage 2.7 means that the proposal is approved in principle and is currently undergoing validation. That means that, maybe a browser manufacturer has put it behind a feature flag, or maybe there's a a Babel plug in, or something like somebody is playing with it, experimenting it and with it, and, you can start seeing how it actually works and whether it actually feels like a good idea. Stage 3 is when the proposal has been recommended for implementation and no changes to the proposal are expected. In other words, they they feel pretty confident that this is how it's gonna be, but it's not yet part of the standard.
Dan Shappir [00:08:39]:
And, therefore, backward compatibility is not yet required, which means that if somebody comes up with a better idea or they come they suddenly discover a problem with it, they can backtrack. So they can even, you know, move it back to stage 2 or even 2 or 2.7, something like that. And, finally, you've got stage 4, which means that the proposal is feature complete and is ready to be included in the standard. Essentially, it means that it's effectively part of the standard, just that a new standard document has not yet been released. One is released once a year. So it, proposals that are complete wait at stage 4 until they are included in the next release standard. And, usually, by the time they're in stage 4, you actually find them implemented in browsers, and you can actually start using them. So far so good? Mhmm.
Charles Max Wood [00:09:42]:
Yeah. It's funny too because you're talking about this process and 2 things are going through my head. And one is it sounds complicated, but yeah. I mean, if you really think about the progression, it all makes sense. Right? The the other thing that's going through my head is, I'm we're currently heading into a legislative session in in the state of Utah. And so I've been going through the process that bills go through to get passed, and I was sitting here going I'm going, wow. This this is in some ways simpler and in some ways, more complicated than the political process.
Dan Shappir [00:10:21]:
In in certain ways, it has to be because unlike the political process, these kind of standards are really set in stone. When something is added into JavaScript, it can never really be removed Yeah. Which means that we had better be really certain about adding it into the standard. And you've got like I said, you've got the browser manufacturers on this committee, and they've got to really approve it and say, you know, this is something that we can actually implement. You know, somebody might have this great idea, but implementing it would turn JavaScript on its head, then, obviously, the the browser manufacturers will will push back and won't approve it. Yep. So let's put it this way. The the attitude is better safe than sorry, and that's a good attitude to have in the context of language standard, especially a language like JavaScript where, as I said, once something is added, it can never be removed.
Charles Max Wood [00:11:26]:
I I I really wish that our legislators would do better safe than sorry. Let's let's think a little more deeply about this before we pass it or not. Right? Anyway, but, yeah, I I I completely agree, and I think it's good context. The JavaScript has always gone way out of its way to be backward compatible. I'm sure there are some times where there was just something that they had to kind of roll back. But
Dan Shappir [00:11:53]:
Actually, the the one time that I can think of where effectively things were rolled back was when they introduced strict mode. And even then, they introduced they rolled them back by introducing strict mode. So if you're running outside strict mode, they're still there. They wanted to roll back, for example, the with keyword, and I won't get into the details of why. It turned out to be a bad idea in the context of the JavaScript programming language, but they couldn't remove it. And so instead, they kind of rolled it back by making strict mode more and more the common way in which JavaScript work and in strict mode with does not exist.
Charles Max Wood [00:12:40]:
Right. Yeah. And and if you're wondering if you're if you're newer to JavaScript and you're saying what what what is strict mode, don't worry about it. You're using strict mode.
Dan Shappir [00:12:51]:
Yeah. Just so you know, you know, it we mentioned it, so we might as well provide details. You can explicitly enter strict mode by having the use strict string at the top of a scope or the top of a file. You can't actually ever exit strict mode. You only enter strict mode. And you enter strict mode by default in, ECMAScript modules. So if you implement a module, it's strict mode by definition. In, HTML, that's if you have a script tag with a type equals module.
Dan Shappir [00:13:28]:
It's, it's strict mode by default, and then you can do module things like imports and stuff like that. You also strict mode by default in classes because, again, classes are kind of a new type of a scope, and it makes sense to be strict by default inside classes.
Charles Max Wood [00:13:45]:
Yeah. I think most people working within the context of JavaScript, though, they're they're working under some system that puts them in strict mode without them
Dan Shappir [00:13:53]:
Yeah. Because they're they're building they hopefully, they're building ECMAScript modules these days.
Charles Max Wood [00:13:59]:
Yeah. So your React projects or, you know, whatever other framework or library you're using generally use modules, and so you're generally put into this box anyway.
Dan Shappir [00:14:10]:
And I really can't think of any other occurrence where something was effectively removed out of JavaScript. Mhmm. So, you know, it's interesting. Yep. Anyway, so let's talk about a couple of these enhancements and proposals. But before we dive into them, it's really worthwhile to highlight the fact that none of them really significantly or maybe even at all change the JavaScript syntax or semantics. So you've got nothing new like the arrow function syntax or let or const or stuff like that, which really changed the way that JavaScript kind of worked. Well, there is one towards the end, but it's still, at stage 3.
Dan Shappir [00:15:00]:
And we'll see if we we make it all the way to that one. But all the rest can are better described as being part of a, quote, unquote, JavaScript standard library. They've added new object types, and new methods or functions that are built in that you can use instead of, let's say, importing some NPM module that would implement them. So we've got more standard functionality being provided out of the box by the JavaScript runtime environment itself, be it the browser or be it node or whatever.
Charles Max Wood [00:15:42]:
Yeah. So what I'm hearing is is that if you're using these you may be already be using these features. They're just now the official standard kind of stuff.
Dan Shappir [00:15:53]:
Yeah. You might have there's a good chance that you might have imported such functionality before. Now it's built in, and you don't need to import it anymore. Kind of like the browser started providing fetch as a built in, function, and you didn't need something like an axials anymore. Mhmm.
Charles Max Wood [00:16:12]:
Yep.
Dan Shappir [00:16:14]:
So the first one I would like to mention is something that's actually 5 years old. It's from ES 2020. And, it's called promise dot all settled. And it as it as its name implies, it waits for all prom this provided promises to be settled. Now, you know, it's very common when working with promises to need to wait on a couple of promises simultaneously, effectively in parallel. And when most developers need to do that, I see most of them reaching out for promise dot all and just using promise dot all. But what they might have not considered is the fact that promise dot all short circuits on a rejected promise. So promise dot all receives an array of promises, and it waits in parallel on all of them.
Dan Shappir [00:17:14]:
It returns a promise that resolves when all the provided promises resolve. But if even one of those promises reject, then the return promise immediately rejects. And that may not be what you're looking for. It may be, but it may not be. Sometimes, you actually want to wait on all the promises provided until they are all of them either resolved or rejected. In other words, all of them are settled, and hence, the name of the method, all settled. Right.
Charles Max Wood [00:17:53]:
So, let me see if I can restate this in a different way. So if you promised dot all yeah. You you if one of them rejects, you get rejected. But it doesn't yeah. But it doesn't tell you that they've all finished waiting for whatever it is that they're waiting for. And so, effectively, the all settles, it it does more or less the same thing. But if you have one of them that's still waiting for whatever, you know, whether it's gonna reject or fulfill or anything else
Dan Shappir [00:18:26]:
So think about a simple scenario. Let's say you have 2, promises. Sorry. Let's say even 3 promises. Mhmm. And you pass the area of the 3 promises into promise dot all. Let's say the first one, resolves. That's great.
Dan Shappir [00:18:43]:
And then the sec then the other 2 are still pending. And then the second one, rejects, then it will immediately return with a reject. It won't wait on the 3rd one to either resolve or reject, and it won't also tell you that the first one resolved. It will just tell you that, hey. This thing rejected.
Charles Max Wood [00:19:06]:
Okay.
Dan Shappir [00:19:07]:
Whereas with promise all settled, what you get back is an array of objects. First of all, it waits on all 3. So even if the second one rejected, it will still continue to wait until the third one completes. And then it will return an array of objects, and each object has a, a field that indicates whether or not it resolved or rejected. Mhmm. So, I I wanted to have this open, and I forgot.
Charles Max Wood [00:19:43]:
I just posted a link to MDN, and it Yeah.
Dan Shappir [00:19:46]:
MDN is always there. Yeah. MDN is always the best. So it basically returns, an array of objects, one for each promise. It had each element of those areas is an object with and it has a property called status, and that status could be either fulfilled or rejected. It has it if it's fulfilled, then it will have a field called value with the resolved value. And if it if it was rejected, it would have a field called reason with the, appropriate rejection reason. So this way, you can look at all the promises and see whether they resolved or rejected and what they actually returned.
Dan Shappir [00:20:30]:
And as I said, in a lot of cases, that's actually what you want rather than just promise dot all. But a lot of people are not familiar with it and use promise dot all when they should have actually used promise all settled.
Charles Max Wood [00:20:44]:
So MDN may makes it look like because it it calls promise dot all settled, you pass in the array, and then it calls dot then. So does it operate as a promise as well?
Dan Shappir [00:20:54]:
Yeah. Yeah. It returns a promise that resolves to that array of objects. Right.
Charles Max Wood [00:21:01]:
Yeah. I just wanted to, you know, clarify because you you said it returns that, but it does it it it's a promise that resolves to that array
Dan Shappir [00:21:10]:
of things.
Charles Max Wood [00:21:11]:
It goes. It has to wait for everything to finish.
Dan Shappir [00:21:15]:
Exactly.
Charles Max Wood [00:21:18]:
That's cool. So I I'm gonna ask another question that's not about all settled, but you said this is from 5 years ago. So when you say that we're talking about new things in JavaScript, are these things that are now generally implemented, or are these just things that, hey. These have passed in the last however long and people ought to know about them, or or what's your criteria for making the list?
Dan Shappir [00:21:45]:
Well, first of all, this this is the oldest one. Everything else that I'm gonna be talking about is newer than that. Mhmm. And I guess my criteria was relatively new things that our listeners might not have known about. Now I think that things that are actually already part of the standard are generally much more interesting that things that are not yet part of the standard. I mean, you know, things that are not part of the standard are might be really cool. Usually, they often push the envelope a lot more, which is one of the reasons that the committee is kind of hesitant about adding them actually into the language. But I think that when you've got the functionality that can actually be used and provides real value, that's more pertinent, let's say, than some pie in the sky that might never actually arrive.
Charles Max Wood [00:22:40]:
Right. So these are probably just hidden gems that you may not have known got added to the language.
Dan Shappir [00:22:48]:
Exactly. And, like, over the last 5 years, I guess. Yeah. K. The next one is from ES 2022. So it's it's almost 3 years old. And it's the dot at method on arrays, strings, and typed arrays. And you basically give it an index, and you get back the item.
Dan Shappir [00:23:12]:
So it's really like using the square brackets in a lot of ways. And you might ask yourself, well, why do I need it? Why don't I just use the square brackets? And the reason is that you can also provide it with negative numbers, and then you're indexing from the end. So if you do dot at on an array and pass in minus 1, you're looking at the last element in the array.
Charles Max Wood [00:23:40]:
Interesting.
Dan Shappir [00:23:42]:
Now that's actually how various other programming languages actually work. So in other programming languages, you might have been able to have the minus in indexes in the square brackets themselves, but you can't do that in JavaScript because that's not how named properties work in JavaScript. And in JavaScript, you could legally have a minus one property, so you couldn't use that. And the funny thing is that this negative index has actually worked with the dot slice method for a long time. Mhmm. But then it would always return an array. Right. And with dot at, you get that actual I element from the array, which is just nice.
Dan Shappir [00:24:30]:
Mhmm.
Charles Max Wood [00:24:31]:
Yeah. I've used other languages that do this with their array. So but they do it with the square brackets and yeah. You're you're explaining why you couldn't do that and maintain backward compatibility with JavaScript. But, yeah, this is this is really cool. I like that.
Dan Shappir [00:24:48]:
Another one that's more of a you should use and probably don't is object dot has own. Are you familiar with the has own property, method that so in JavaScript, you can there's the in operator, which tells you whether or not a property exists in an object. Objects in JavaScript kind of work like property bags, and you can check to see whether a particular string is the name of a property in the in an object using the in operator. But the in operator also looks up the prototype chain. So So it
Charles Max Wood [00:25:27]:
doesn't always say this this is cool. I just looked it up, and I am I've yeah. Anyway, go ahead.
Dan Shappir [00:25:34]:
Now has own property has existed forever as a way to check, whether a property name exists in an object without going up the property chain. The problem with hasOwnProperty is that not all objects necessarily have it because you need to, have the object prototype in your prototype chain to actually have it, and it's not there by definition. So you might try to use hasOwn property only to have it break because you're not actually your object doesn't actually derive from object prototype.
Charles Max Wood [00:26:15]:
Mhmm.
Dan Shappir [00:26:15]:
So the safer way is to do object dot hasOwn as this kind of a global method, static method. And the first parameter is the object you wanna test, and the second parameter is the name of the property you wanna check.
Charles Max Wood [00:26:32]:
Right.
Dan Shappir [00:26:32]:
So it's just a safer way. So the preferred way to check whether or not a specific object has a particular property is not using has own property, which is what most of us do, but rather using object dot has own. Yet I've don't recall ever seeing code actually work like that. So Right.
Charles Max Wood [00:26:55]:
So if you've this, for example, could tell you if you've overwritten a property. Right? You've written your own function for,
Dan Shappir [00:27:04]:
you know, a dictionary or whatever. Yeah. A lot of people use, JavaScript object objects as dictionaries. Mhmm. You know, ideally, I think they should be using the map object type. But a lot of people still like using, simple objects because, you know, it's easy to convert to from JSON and so forth. And you wanna check whether, let's say, a certain property exists in a JSON object or not. So you might use check it using hasOwn property.
Dan Shappir [00:27:36]:
You should actually check whether or not it exists using hasOwn.
Charles Max Wood [00:27:41]:
Mhmm. Gotcha.
Dan Shappir [00:27:45]:
So those are two things that were added almost 3 years ago in e s 2022 dot at and object has own. Relatively new, I guess, mostly not so much used, but they're there and they're useful. And I guess people should be using them more. Moving on. ES 2023. Here's a nice one that a lot of people, I think, might like, and this is find last on ARES. Sometimes you wanna find the last element matching a particular thing rather than the first. Now, obviously, you can do reverse and then find, but why reverse the entire array when you can just do find last?
Charles Max Wood [00:28:41]:
Nice. It's funny because I'm, I'm looking at the, oh, it does have find last in here, but it also had find last index of, which I guess is related, but not the same.
Dan Shappir [00:28:56]:
Yeah. Find and find last return the actual value. Find index of and find last index of return the index of the found element.
Charles Max Wood [00:29:08]:
Right. And this this finds a matching element. Right? So you can pass it a a function, and you can say if if this returns true on the element, then
Dan Shappir [00:29:17]:
Yeah. Let's say you want you have an area of numbers, and you want to find the first one bigger than 42. Right. So you can pass in a function that compares the x you know, you would do x and or
Charles Max Wood [00:29:29]:
x. 42. Yeah.
Dan Shappir [00:29:31]:
Exactly. And with find regular find, you would find the first element greater than 42. With find last, you simply find the last item greater than 42. Yep. And and like I said, usually what people would do is that they would reverse the array, and it's kind of silly to need to reverse just to find the last one.
Charles Max Wood [00:29:50]:
Right.
Dan Shappir [00:29:53]:
Speaking about reverse, the next things that I wanted to mention that came out in 2023 are the change array by copy. Again, talking about things that were in JavaScript that are a bit unfortunate but cannot be fixed because backward compatibility, we have certain methods that modify arrays in place. So, for example, if you do dot reverse on an array, it reverses the array in place. Likewise, if you do dot sort, it sorts the array in place. And that's not how we want to work in a more, quote, unquote, functional world. I guess they did it back in, 95 because for efficiency sake to avoid the extra locations. But you really I you know, it's you really want to avoid methods that modify objects in place if you can if you can avoid it. Mhmm.
Dan Shappir [00:30:56]:
So what they did is they introduced an alternatives well, not not an alternatives, alternatives to these methods, that create a copy. So instead of reverse, there's this new dot to reversed.
Charles Max Wood [00:31:15]:
Mhmm.
Dan Shappir [00:31:17]:
And to reverse does not modify the original array. Instead, it returns a new array, which is reversed. Likewise, you've got the dot to sorted, which, again, sorts an array, but rather than sorting in place, returns a new sorted copy. Right. And you should be using these. There's absolutely no reason. What I used to see are people copying the array by doing a dot slice and then doing a reverse on the copied array.
Charles Max Wood [00:31:56]:
Mhmm.
Dan Shappir [00:31:57]:
And now they can just do 2 reversed or 2 sorted. There's also there's also a too spliced, reminders. Splice, unlike slice, you it can be used to replace to delete parts of an array and replace parts of an array. Too spliced does that, but instead of modifying the original array, again, returns a modified copy. Yep.
Charles Max Wood [00:32:25]:
There's also a 2 sorted.
Dan Shappir [00:32:28]:
Yeah. I mentioned already the 2 sorted.
Charles Max Wood [00:32:30]:
Yep. And then there's dot width is the
Dan Shappir [00:32:33]:
other Yeah. The yeah. The dot width is confusing because it's kind of not 2 something. So where did this come from? Dot width is like dot at, but it modifies the copy. So, it modifies a particular item. You know, with dot at, you could change the value of a particular item. With dot with, you give an index and a new value, and it replay and it creates a copy where that particular element, you you know, with that index has the new value. So you might have an error rate, let's say, with 123, You do dot with 1 comma 42, so it will become 1423.
Charles Max Wood [00:33:19]:
Mhmm. Yep. And that I agree with you on the this should be your default way to move through arrays. I mean, we we run into these problems all the time where you inadvertently change something that you didn't intend to. And so by doing things in this way, you'll avoid those issues unless you explicitly want to be changing that for a for a real good reason.
Dan Shappir [00:33:46]:
Exactly. And especially because in JavaScript, when you pass arrays into, functions or methods, you're passing the reference to the array. Right. So you're actually, passing the reference to the original array. And if that method then or or function then calls dot reverse on the array that was provided to it because it needs a revert a reverse copy for some reason, but use reverse instead of to reverse, it not only modifies the array for itself, but also for whomever called it, which is totally unexpected behavior in most cases.
Charles Max Wood [00:34:25]:
Yep.
Dan Shappir [00:34:29]:
So yeah. For sure. Going forward, always use to reversed instead of reversed, to sorted instead of sorts, to spliced instead of splice, and dot with, whenever that makes sense. Continuing to move up the calendar, we're, you know, we are now in 2,025. Let's look 1 year back, 2024. We also got a couple of things. We got, top level await. And by top level, it means top level of a module.
Dan Shappir [00:35:06]:
So if you're creating an ECMAScript module, you can have a wait outside of a function body. In the past, you could only use a waits inside a sync functions. Now you can actually use a weights outside ins but at right at the global scope as it were, but only inside modules. You might use it to maybe import some sort of dynamic mode do some sort of dynamic module import or maybe get some configuration file or something like that. So you might want to do a fetch in order to get some configuration or something like that. But you really need to be careful with top level awaits because they block the module load. So if you've got 1 module waiting, importing a submodule and that submodule does a global await, then it blocks the module that imports it until that promise resolves. Is that clear?
Charles Max Wood [00:36:22]:
Mhmm. Yeah. There's there's a really good example on the proposal itself, and I posted a link to that, the t c 39 proposal, where, essentially, what they're doing is they're running the await within a function that's kind of the you create a function, and then you call the function is effectively what you're doing with the await in it. That's an async function, and they've done it with, an immediately invoked async function as well as just, a named function that they call that's an async function. But yeah. Yeah. I I can see where this could be a foot gun where you could shoot yourself in the foot doing this. Yeah.
Charles Max Wood [00:37:11]:
For sure. But but I can also see the utility in it. Right? It's like, in order for this module to do anything useful, I have to have this other thing.
Dan Shappir [00:37:20]:
Yeah. Without this data, I can't do anything. Yeah. So I really need to wait on that data before I can actually even finish loading.
Charles Max Wood [00:37:29]:
Right.
Dan Shappir [00:37:31]:
But, again, you should definitely be really careful about using top level await inside your actual code.
Charles Max Wood [00:37:39]:
Yeah. I definitely have a reason to be doing this.
Dan Shappir [00:37:45]:
The next ones I want to mention, and they're really useful functions and have been available in a lot of other languages and are provided by libraries like Lodash, is object dot group by and map dot group by. Let's start with object dot group by. With object dot group by, you provide an array of of stuff and a function that you invoke it, sorry, on, on an on a a a collection of items, and you also provide a callback function which returns strings that describe each item in the sequence, and then it groups the items based on the string value. It's kind of difficult to explain, but very often, we want to take a collection of stuff and group those things according to what they are. So, for example, I've got I might have, like, different types of different objects in an array, and they also all all of them have, let's say, a different type, which is a string. So I can group them according to that the value of their type property and have, a sub return one array of, all of all the objects of one type, another array of all the objects of another type. It's instead of having to filter again and again and again, I can do it in one go.
Charles Max Wood [00:39:16]:
Yeah. This is something that I use pretty frequently in other languages as well, but, the and there's a really good example on the MDM doc that I just posted. But, yeah, I mean, they give a list, asparagus, bananas, goat, cherries, and fish. They all have a type property of vegetable, fruit, or meat, and then it tells it to, group by type, essentially. And I'm not gonna read the syntax for you. You'll have to go look at it because it's hard to just read out. But, yeah, then it gives back an object that has properties of vegetables, fruit, and meat, and it's shoved those objects up underneath that. So, it makes it really easy to, like you said, not have to iterate over it a zillion times if you're just sorting things or handling things based on their type.
Dan Shappir [00:40:01]:
Exactly. Now the only difference really between object dot group by and map dot group by is whether or not the result is an object with the various fields or a map with the various entries. Some people would prefer to work with a map. Some people would prefer to work with an object, so they can use either object dot group by or map dot group by, but the algorithm is essentially exactly the same.
Charles Max Wood [00:40:26]:
Yeah. It's interesting too because the so the on MDM for map dot group by, it it hands it an array for the things that it's and it has the same list of things actually as object dot group by, but it hands it an array for the thing that it's sorting. And, yeah, it just gives back a map instead. So kind of interesting there.
Dan Shappir [00:40:56]:
Now the final one that I want to mention is one that's gonna make a lot of our listeners kind of groan because a lot of people have really wanted something like that and have written a lot of boilerplate code to effectively implement this functionality. And so it's kind of nice to have it now built in out of the box. But on the other hand, I'm I'm kind of worried that people will abuse it or misuse it. It's promise dot with resolvers. When we create a promise, only the promise can kind of resolve or reject itself. So you do new promise, you pass in a function to the constructor with, resolve and reject, and that function and the promise constructor invokes that function, and only that code has access to the resolve or reject. You can't resolve or reject a function a promise, sorry, from the outside. Now what people do when they do want to be able to resolve, reject a a method, promise from the outside is then they actually copy, resolve and reject into global variables outside the promise scope, and it kinds of it kinda feels wonky.
Dan Shappir [00:42:22]:
Are you following what I'm trying to describe? Not entirely. Let's say I have a promise, but I want to have some sort of an external event resolve it.
Charles Max Wood [00:42:36]:
Mhmm.
Dan Shappir [00:42:37]:
So I do a new promise, and I and I pass in, the function that gets the resolve, but I can't resolve it from inside the promise. I want to have just an access to that resolve to resolve it somewhere else. So I I copy the val the reference to the resolve and hand it over to somebody else. And then that somebody else can resolve me.
Charles Max Wood [00:43:04]:
Okay. Sounds complicated, but I think I understand. Let me see if I can restate it just so that I get it. So,
Dan Shappir [00:43:14]:
I have a promise.
Charles Max Wood [00:43:14]:
For whatever reason, I'm not gonna use the the default, you know, dot then to resolve or, you know, dot what are the other ones like? Dot dot error.
Dan Shappir [00:43:24]:
No. You're not it's not exactly correct. Let let's say you've got a a a you do a new promise, and you pass in a function with with the resolve and the and that gets resolve and reject. And then you take the resolve and put it in window dot resolve. And you take the reject and you put it in window dot reject. Okay. You can call window dot resolve to resolve that promise.
Charles Max Wood [00:43:49]:
Uh-huh.
Dan Shappir [00:43:50]:
So you're copying that resolve method out of the promise into somewhere else. In that in the case I just gave, it's doing into a glow effectively into a global
Charles Max Wood [00:44:00]:
Make it into a global.
Dan Shappir [00:44:01]:
Yeah. But you can also copy it into a a local variable in a in a scope. But
Charles Max Wood [00:44:06]:
you're just
Dan Shappir [00:44:07]:
copying it out of the promise. And I've seen a lot of instances where people needed to do that for some reason. They they want to be a they they have a promise, but they want to be able to just resolve it from somewhere else. Mhmm.
Charles Max Wood [00:44:25]:
I'm trying to think of why you would need to do this. But
Dan Shappir [00:44:31]:
there's there are good examples in the in the MDN, but I've seen a lot of of examples of such thing. I've even seen example of something like that within React's on code when they implement, the when they they kind of throw, promises to, to, do to in order to, implement suspense. So it it's implemented by throwing promises, and you need to be able to resolve those promises from the outside. So they also kind of hold on to the resolve and reject of the promises on the outside of on the outside of the promise itself.
Charles Max Wood [00:45:08]:
Okay.
Dan Shappir [00:45:10]:
So with resolvers actually does that for you in a kind of built in way. It re instead of returning a promise, it returns an object that has 3 properties. Property called promise, which is the promise, a property called resolve, which is the resolver function, and a property called reject, which is the rejector function.
Charles Max Wood [00:45:35]:
Okay.
Dan Shappir [00:45:36]:
So and you can, destruct the the return value and basically get the promise, get the resolver, and get the rejector.
Charles Max Wood [00:45:47]:
Right.
Dan Shappir [00:45:49]:
So in cases where you need this kind of functionality, and as I said, I've seen this pattern used a whole bunch of times, it's now much easier and cleaner to do it because it's built into the language itself.
Charles Max Wood [00:46:03]:
Okay. So from what I'm because I'm looking at the proposal as well now. So, essentially, what you do is you, yeah. You you pat you do promise with resolvers and it deconstructs the promise so that you just have references to the promise resolve and reject as as functions or objects. And then and then you can yeah. And then you can
Dan Shappir [00:46:27]:
is an object and resolve and reject our functions.
Charles Max Wood [00:46:30]:
Right. And so so then what I can do is I can I can basically, reference those wherever I need? So if I have something else that needs to resolve or reject the promise, it
Dan Shappir [00:46:45]:
it just calls it just call it can just call resolve or reject it directly.
Charles Max Wood [00:46:49]:
Yeah. It can just do it without having to, right, without having to do work some magic on the promise object to, you know, get it the internals or something like that.
Dan Shappir [00:46:59]:
Exactly. So it's a it's a convenience method. You can definitely write the code yourself, but it was just really ugly boilerplate code. I've seen it done lots of code bases that I've that I've looked at, and it's nice to have a cleaner alternative. But you should have a good reason to use it rather than use the regular func promise semantics.
Charles Max Wood [00:47:25]:
Mhmm. Yeah. It's funny because you were talking about people having implemented it. And on the TC 39 proposal, it's like existing implementations and it shows where React did it and Vue did it and Axios did it and TypeScript did it and Vee did it. Deno did
Dan Shappir [00:47:40]:
it. So Exactly. Exactly. And so now it's built in, and there's no reason for any of them to actually do it themselves.
Charles Max Wood [00:47:46]:
Yep. Makes sense.
Dan Shappir [00:47:49]:
Okay. Now we're kind of done with things that are already actually in the language. Let's look at things that are not yet officially part of any standard, but are stage 4.
Charles Max Wood [00:47:59]:
Stage no. They are stage 4.
Dan Shappir [00:48:01]:
Which means that they are effectively part of the standard, just that the standard the relevant standard has not been released yet. Now,
Charles Max Wood [00:48:10]:
funnily enough Hang on. So what does that mean? It means that the they've adopted the proposal, but they haven't rewritten ECMAScript standard to include them yet?
Dan Shappir [00:48:19]:
Exactly. They release the standard once a year. So they'll release ES 2025 sometimes later this year, but these things are kind of waiting for that document to be released.
Charles Max Wood [00:48:31]:
I gotcha. So so people might be furiously working away at them now because they know what's
Dan Shappir [00:48:37]:
going on. All of them are actually the the ones that I'm gonna mention are actually implemented in browsers.
Charles Max Wood [00:48:43]:
Oh, okay.
Dan Shappir [00:48:45]:
But but they're not because from the browser's manufacturer's perspective, they've they've arrived.
Charles Max Wood [00:48:52]:
Right.
Dan Shappir [00:48:53]:
So why wait for the document if we know that they are gonna be part of the document?
Charles Max Wood [00:48:58]:
Makes sense. Extra credit to the browsers.
Dan Shappir [00:49:02]:
Yes. Indeed. And the funny thing is that I've actually mentioned them in in that episode 5 90 a year and a half ago. Only then they were stage 3. So it took them a year and a half to progress to stage 4.
Charles Max Wood [00:49:18]:
Yeah. But, again, I like that they're being deliberate about it. So
Dan Shappir [00:49:22]:
Yeah. For sure. So the first one are set methods. Do you know the set object type in JavaScript? Have you used it? No. Set is kind of like, the the set in math. It's basically a collection type Oh, yes. Where something can either be part of the set or not part of the set.
Charles Max Wood [00:49:44]:
I thought you were talking about, like, an a method on object or something called set object type. But, no, the set yeah. I've
Dan Shappir [00:49:50]:
Yeah. You do new set. Exactly. New set, you pass in an an array of stuff to the constructor, and, then those things are in the set, and you can check whether something is in the set or not. You can add more stuff to the set or remove it from the set. But it's basically just to to check if something is a part of a Right. A collection or not. And they and the thing is, like, as I alluded, set is really similar to set in math, and there are a whole bunch of operators that you can apply on sets in math.
Dan Shappir [00:50:27]:
And it makes sense to have them on sets in JavaScript as well. So you've got, for example, union, which can take 2 sets and return a new set, which is the union of those 2 sets so that it contains all the items that are in each one of them. Now it's an union rather than a concatenation because everything is in a set either either 0 or one time. Right. So if it's a set of 1, 2, and another set of 2, 3, and you do a union, you get the set with 1, 2, 3.
Charles Max Wood [00:51:00]:
Right.
Dan Shappir [00:51:02]:
Likewise, you've got dot intersection, which can, create an intersection of 2 sets or dot difference, which, returns the difference between 2 sets. And, and these whole bunch of methods that have been introduced to sets and just makes working with sets, like working with mathematical sets, much cleaner and easier. I assume that they were there was probably more than 1 package package on NPM that implemented all this functionality. It's pretty straightforward to implement, but now it's built in. So you don't need those NPM packages anymore.
Charles Max Wood [00:51:40]:
Yep. Yeah. And it makes a lot of sense because, typically, when you're using because because other collection types, you know, dictionaries or arrays, you're you're usually using those to to hold all your data. And like you said, I like the way you put it where it's a math like the mathematical set. So this is you typically use sets for certain types of operations. And so if you need a a friendly and easy way to to do those kinds of operations, you can use sets.
Dan Shappir [00:52:10]:
Exactly. That's what sets are for. So so it's really nice to have those methods now built into the JavaScript programming language. It's not like this big revolution. It's not like arrow functions or, like, let's let's our cons, but it just makes JavaScript a nicer language out of the box.
Charles Max Wood [00:52:30]:
Yep. So sets are a new addition? They didn't?
Dan Shappir [00:52:33]:
Well, sets have been here for a long time. Sets were introduced with maps, I think, way back in ES, what's called ES 6 or ES 2015. So they've been here for, like, a decade. But, it's nice to have these operations on sets now part of the standard.
Charles Max Wood [00:52:53]:
Okay.
Dan Shappir [00:52:55]:
As I said previously, you had sets, but if you wanted to do these in operation like union, you would have kind of needed to implement it yourself. And it it wasn't difficult. You could spread the set into an array, then concaten the the the the 2 arrays and create a new set out of them. Right. And you would get the union, but a whole bunch of copying going on. So now you've got a a cleaner, more efficient implementation Mhmm. And certainly an alternative to bringing in yet another NPM package. Right.
Dan Shappir [00:53:29]:
The other thing that was stage 3 and now is released, and it's a bit more difficult to explain, are sync iterator helpers. So we've had episodes in the past, way back in 2021, where I actually gave I talked for 2 whole episodes about iterators and why I think they're great. And I think I might have been able to convince AJ for the duration of the episode, and then he immediately changed his mind once that episode was over. Those were episodes 468469 for those who are interested in the details of what iterators are and how they work. I won't go into too much detail. Basically, it means that we now have methods like dot map map or dot filter or dot reduce on iterators like we have them on, let's say, arrays. And the easiest way to explain how to use them is think of let's say I have an array of stuff, and I would do array dot, let's say map and then dot filter and then dot, reduce or something like that. Now I I can wrap the array itself in in something that in in something.
Dan Shappir [00:54:52]:
It's iterator dot from. So I do iterator with a capital I dot from on the array and then on the return value from that, I do the dot map dot filter dot reduce, etcetera. Now you might ask yourself, why would I do that and what's the difference? So first of all, it returns an iterator that rather than an array. So if I then want to actually get an array in result as a result, I need to actually spread it into an the result into an array. So you say, hey. This is actually even more work. I needed to do add an iterator from on the original array and then spread the result into an array and, you know, what's the upside of all this? Why why would I want to do all this stuff? There are a couple of reasons. First of all, iterator dot from is not just for arrays.
Dan Shappir [00:55:43]:
It's for anything that's iterable. So it means that if I now have a new collection type so for example, maps or sets in JavaScript, they are collections. They actually implement the for each, but they don't implement the filter. They don't implement a find. They don't implement a reduce. They don't implement, filter. So how do I how do I invoke those methods on those types of collections? What I would usually see people doing is either avoid using these collections if they needed these methods or, alternatively, copy them into arrays. And if you're gonna copy them into arrays, then you might as well have just used arrays.
Dan Shappir [00:56:32]:
So now I can apply iterator from to anything that that supports iterators, any collection type that supports iterators, and then I can use all these methods on that collection. So that's advantage number 1. I don't need to implement those methods directly on each and every collection type. I just need to implement iterators in the collection, and then I can use these methods on any collection type, be it a built in collection or one that I implement myself. Okay? So that's advantage number 1. Okay? Mhmm. The second advantage is that it avoids all the, intermediate arrays. When you do, dot map on an array, you get, as a result, the array of the of the map.
Dan Shappir [00:57:25]:
So when you do dot map dot filter dot whatever, you're getting a whole bunch of intermediate arrays that you're copying stuff from 1 to the next to the next to the next and so forth. With iterators, they don't create those intermediate arrays. They work, by doing lazy evaluation. You just get the results that you need. Only the computations that that are required without all the intermediate arrays. So they're actually they can actually be a lot more efficient in cases where you don't need all the values. Right. And I'm really happy that they're here because iterators have been kind of a dud feature in JavaScript because they lacked all these, helper functions.
Dan Shappir [00:58:15]:
Hopefully, now maybe they'll they'll get some more love from the JavaScript developing developer community. Time will tell. Maybe it's too late. I don't know. We'll see.
Charles Max Wood [00:58:27]:
Yeah. So so these are the async iterator helpers. Right?
Dan Shappir [00:58:32]:
No. These are the sync iterator helpers. Oh, just a second. The the the the sync iterator helpers are here. They exist in in browsers. You can already do iterator from inside Chrome, inside Safari Okay. Inside Firefox. But what we don't have yet are async iterator helpers.
Dan Shappir [00:58:55]:
They're stuck in stage 2, I think.
Charles Max Wood [00:58:57]:
Yes. They are. This one state says it's stage 4. So
Dan Shappir [00:59:02]:
Yeah. The sync ones are stage 4. The async ones are stuck in stage 2. They've been stuck there for a whole while. That's really unfortunate. Again, what's the difference between helpful. Yeah. And and if our listeners are interested in the difference between sync iterators and async iterators, they should listen to episode 469 where I explained the difference in detail.
Dan Shappir [00:59:28]:
The other thing that I wanted to mention, which is kind of here, are JSON modules. You can now import not only JavaScript, you can import JSON.
Charles Max Wood [00:59:43]:
I'm sorry. Say that again?
Dan Shappir [00:59:45]:
You know the JavaScript import command?
Charles Max Wood [00:59:48]:
Mhmm.
Dan Shappir [00:59:49]:
Well, you can now import not only JavaScript modules, you can import JSON files, and the result of the import is the JSON object.
Charles Max Wood [01:00:01]:
Oh, cool.
Dan Shappir [01:00:03]:
You just need to tell the import that you're importing a JSON. It it, you you basically tell it you assert that this is the type of what you're importing. Is that is that kind of clear? Mhmm.
Charles Max Wood [01:00:24]:
Yep. I'm just trying to find an example on the Internet, but that makes sense.
Dan Shappir [01:00:28]:
You you do you do import JSON from something dot JSON, and then at the end of that instruction, you add with open curly brackets, type, colon, JSON, close curly brackets.
Charles Max Wood [01:00:42]:
Oh, okay.
Dan Shappir [01:00:45]:
Theoretically, in the future, we might have other types. I don't know. Maybe we'll import CSS or text files or I don't know what. But for now, we've got it for JSON. Now why is this useful? Because, I mean, you could just do, a a fetch and then Yeah. Do a JSON parse. Why do we need to import? To be honest, it's more of a convenience than a necessity, but the convenience is that in a lot of cases, we use JSON as configuration. And it's really useful to be able to directly import such configurations into the code.
Dan Shappir [01:01:24]:
Yep. Think about, I don't know, a webpack configuration or something like that. Mhmm. So you're creating some sort of a of of a node based, utility, and that utility uses some sort of JSON configuration. And now you can just import that configuration at the top of your file and then just use that configuration. Because if that configuration is missing, there's really nothing that
Charles Max Wood [01:01:56]:
you can do. Yeah.
Dan Shappir [01:02:01]:
And it also works with dynamic imports, by the way. Oh, nice. So, yeah, it's it's it's again, it's not earth shaking, but it's really useful, I think, and it's nice to have it built into the language. Yeah. Well it's stage 4, so that means that it's here.
Charles Max Wood [01:02:20]:
Yeah. The the way I think about it is is you import all the things that are required to run your application. And, yeah, typically, that's gonna be other JavaScript files. But, yeah, the it makes sense, right, that you may have some setup data or whatever that you need in order for it to work. And so it's it's another requirement. It's just not code.
Dan Shappir [01:02:41]:
Exactly. It's a declarative way to load your configuration data into your code, basically. And you can be, certain that that config if that configuration fails to load, then your code fails to load. And if it successfully loads, then your code then gets to run with that configuration. It kind of blocks on that configuration. It doesn't proceed until that configuration is loaded. So it's not like I'm loading some configuration asynchronously. I need to wait for it or write code that waits for it or something like that.
Dan Shappir [01:03:17]:
I can just import it and and use and rely on the fact that, if I if I load it successfully, it means that I have this configuration data.
Charles Max Wood [01:03:27]:
Yep. Also, for the iterator conversation, I did post, episode 469 just so that people can go reference that if they want.
Dan Shappir [01:03:39]:
Yeah. Basically, they probably want to listen to both 468469 together, to be honest. Yeah. Since we're running short on time, I want to mention just one stage 3 standout. It's it's, being stage 3 means it's not yet here, so don't go try to use it. But you there are various existing ways for you to actually test implementation, either NPM modules that implement it or, you know, Babel plug ins or some stuff, something like that. It's, the temporal object, or temporal namespace, actually. It's a more accurate way to put it.
Dan Shappir [01:04:21]:
We all know that the JavaScript date object is pretty bad. It it has it has a lot of, problems and limitations with it.
Charles Max Wood [01:04:35]:
I've I've done hand to hand combat with it before, and I have lost some of those battles.
Dan Shappir [01:04:43]:
Yeah. There are problems around working with the time zones with it. It only really supports your own your own time zone, And doing all sorts of daylight saving time computation is really challenging, and it and it's mutable, which makes it really problematic. It's it's it was created back in, in, 1995 based on the Java, the then Java date object. Java actually fixed their date object, but in JavaScript, you couldn't for backward compatibility reasons, so we are stuck with it.
Charles Max Wood [01:05:20]:
Mhmm.
Dan Shappir [01:05:21]:
So so temporal aims to fix this these problems by providing an alternative to date. So date will still be there because, obviously, you can't take something away. But now instead, you can use temporal. And by using temporal, you'll avoid the need for stuff like moment. Js and other, NPM modules, which aim to fix a lot of the time problems that we that we face when we need to deal with date and time in JavaScript. Yep. Other thing it supports non Gregorian calendars for people who care about these things. For example, the Hebrew calendar, you've got more, date format parsing of options, so on and so forth.
Dan Shappir [01:06:05]:
Just adds a whole bunch of functionality for dealing with date and time in JavaScript. Now as I said, unfortunately, it's still stuck in stage 3. I guess it's really complicated to get everything right in such a complex, complex domain, so they're taking their time. Hopefully, we'll get it eventually.
Charles Max Wood [01:06:25]:
Yeah. I was gonna say I as fraught as time and time zone and all of that stuff gets, and it's not just JavaScript. I I know that the we have some listeners that are kinda polyglot folks, so they work on the back end in Ruby or Rust or Go or something. Right? And so so you folks know that, hey. Some some of this stuff is maybe easier in that language, but it's still hard, sometimes. And then the folks that only do JavaScript like this is, it's it's a hard problem. And so, yeah, I understand why, yeah, they may be working through some of the finer details, to make sure that they get it right. Because, yeah, if if they put in an implementation that really does kinda just shine, I mean, that that's a big area of pain that a lot of people have to deal with.
Charles Max Wood [01:07:22]:
Now you said it's stage 3. So is it implemented or somewhat implemented or partially implemented in browsers?
Dan Shappir [01:07:29]:
No. It's not really implemented in browsers as far as I can tell.
Charles Max Wood [01:07:32]:
Okay. They do have some polyfills that are listed in the proposal?
Dan Shappir [01:07:36]:
Oh, yeah. For sure. It's it's an object in JavaScript. It's a namespace in JavaScript, so you can definitely polyfill it. There's, but, you know, some of these polyfill first of all, I I haven't checked how complete these polyfields are. And,
Charles Max Wood [01:07:53]:
the Yeah. The read me says so it was updated. Oh, that's helpful. It says it was updated last year. Very, very helpful. It does list other changes 2 months 4 months ago, so it might be longer ago than that. But the 2 that it lists are at jstemporal/ polyfill, which I'm assuming is an NPM package, and that says that the alpha release is available. And then temporal dash polyfill, which is a full calendar, implementation is it says the beta release is available.
Charles Max Wood [01:08:27]:
So it might be worth looking at, but, yeah, it it doesn't look like any of these are entirely stable.
Dan Shappir [01:08:36]:
Now we've effectively run out of time. I was going to talk about 2 more. One, one is the explicit resource management with the using keyword. It's this one actually does modify JavaScript semantics. I did actually discuss it, way back in episode 5 90, a year and a half ago. It was stage 3 then. It's still stage 3 now. So, the the one interesting thing is that TypeScript actually added it in, version 5.2 about a year and a half ago.
Dan Shappir [01:09:15]:
So it seems that, TypeScript kind of jumped the gun on that one. They saw it in stage 3. They assumed it was gonna be released soon, and so they added support for it and but it's not here yet. So it exists in TypeScript, but not in JavaScript, which is amusing.
Charles Max Wood [01:09:32]:
Yep. I just posted a link to that episode as well.
Dan Shappir [01:09:35]:
Yeah. And the other one is something with this really cool name called Shadow Realm. I guess we'll need to find a different episode to talk about that one. It's that one is currently in stage 2.7, which means it's not even stage 3. But it's
Charles Max Wood [01:09:52]:
Sounds good.
Dan Shappir [01:09:53]:
Yeah. You know, one of the things that I've been thinking about, and maybe if we get, requests from our audience to do it, is to do another episode about JavaScript features stuck in purgatory. There there are whole bunch of really yeah. There are whole bunch of really interesting JavaScript features that have been staged to for, like, what feels like forever. I wonder if it's worthwhile to actually even talk about them. Because on the one hand, they're some of them are really cool and really interesting, and they add a lot of really interesting twists to the JavaScript language. But on the other hand, seems like they're they're just they they're just stuck there. So the committee is not really doing away with them, but they're also not progressing them.
Dan Shappir [01:10:42]:
They're so they're kinda stuck. I wonder if it's worthwhile to even talk about them. What do you think? I
Charles Max Wood [01:10:48]:
think that would definitely be interesting. It it's also interesting sometimes the how do how do I put it? There are things that kind of flowed out there for a while. I'll go back to the the legislative example. Right? Because I mentioned, you know, laws passing and bills passing and stuff. There are things that get proposed, like, every year that just never quite get enough traction. And sometimes what's needed is somebody just points it out, and then all of a sudden some energy comes up behind it and and things move. And so, I'm imagining that, you know, I don't know that we have that bit that kind of influence necessarily, but it could start the process so that other folks start talking about it too. And we we get some exposure as far as, oh, this really is a good idea, and we ought to just go and finish it.
Charles Max Wood [01:11:39]:
Right? Whether that's, maybe we modify it to solve some of the concerns or, you know, there's a little bit more work put into just, you know, putting the polish on it or whatever, and then we get another cool thing in JavaScript.
Dan Shappir [01:11:53]:
Yeah. And I would imagine that AJ would be really happy that they're not here yet or not here maybe forever.
Charles Max Wood [01:12:02]:
Yeah. Well, cool. Well, yeah, I mean, all of this stuff's really, really fascinating, and I'm I'm looking forward to hopefully seeing more and more people use some of these features.
Dan Shappir [01:12:12]:
Yeah. All the features that we spoke about today are effectively in the language. So there is there is absolutely no reason not to use them. And in fact, as I explained, in some cases, it's preferably preferable to use them rather than the alternatives. So as an example again, instead of dot reverse, use to reversed. That's like a prime example of of, something that we should use. Or another one, if you're doing all sorts of mathematical operations with unions, then maybe instead of using some NPM, package, you just use what's now built into the JavaScript language itself.
Charles Max Wood [01:12:51]:
Yep. So I did a search on Shadow Realm, and it looks like there's a a twilight, something twilight. I think it's d and d book that's called Shadow Realm. And then, there were, like, 8 18 of the front page links were Yu Gi Oh,
Dan Shappir [01:13:11]:
the
Charles Max Wood [01:13:12]:
card game. So
Dan Shappir [01:13:13]:
In other words, it it must be a cool JavaScript feature if it's called Shadow Realm. I mean, you have to admit the name is really cool.
Charles Max Wood [01:13:21]:
Yep. So, anyway but, yeah, I I'd love to dive into some of these features. Yeah. Some of the ones that are in limbo or purgatory or whatever you wanna call it. Yeah. But it's also good to just see some of this stuff come along. And like you said, none of these are huge changes, but some of these sure seem like they'd make my coding either more stable or easier to do. And so I'm I'm all about that.
Charles Max Wood [01:13:49]:
So, alright, well, let's go ahead and do our picks. Do you wanna do picks first, or do you want me to go first?
Dan Shappir [01:13:55]:
I can go first. Alright. So first of all, people who are listening might have noticed that I've got a bit of a head cold and a stuffy nose. Hopefully, that goes away. So my first pick would be for my head cold to go away. Mhmm. Yeah. It's not really such a huge bother.
Dan Shappir [01:14:11]:
It's just annoying. So that would be my first pick. My second pick is we actually had a fun day to day at work. We are the the team that I'm mostly working with. We went out together to do to play laser tag, which was a whole was was a lot of fun. So my second pick would be to have fun days as team building exercises. And the 3rd pick would be to do a laser tag game because it's just fun. And those would be my picks for today, short and sweet.
Charles Max Wood [01:14:42]:
Yep. Laser tag is fun. I'm gonna pick it's it's a second version of a board game I've picked in the past. So I've picked Machi Koro in the past, and, essentially, just to give you an overview of Machi Koro, essentially, you're building a town, You buy buildings, and then you roll dice, and you get money based on whether it's somebody else's team or your team and whether you have a card with that number on it. And then you buy landmarks, and once you've built all 4 landmarks, you win. That's Machi Koro. Machi Koro 2 is a little bit different. So instead of building 4 landmarks, you only have to build 3.
Charles Max Wood [01:15:29]:
But the other thing is is that in Machi Koro, you put out all the different types of buildings you can build in your in your town. In Machi Koro 2, what you do is you have decks of cards that have numbers 1 through 6, decks of cards that have numbers 7 through 12, and then you have landmarks. And so you flip cards over until you have basically 5 unique buildings in each row, and then you you win when you build 3 landmarks. And so you play the rest of the game plays the same. You roll the dice. If you have the building, you get paid. The landmarks in Machi Koro, the original have fixed pricing for each landmark. In Machi Koro 2.
Charles Max Wood [01:16:14]:
Your first landmark has a cost. Your second landmark has a cost. Your third landmark has a cost, and those costs are on the card. I mean, those are the only differences. The rest of the gameplay is the same. It does give you a little bit more variety, and it makes the strategy just slightly a little bit more you really have to think about it a little extra in order to get what you want, because the cards do give you different abilities, But it's not such a wide breadth of abilities that you're going, oh, man. I don't know how to figure this game out. So, we played it with, some friends of ours.
Charles Max Wood [01:16:51]:
We got it for Christmas. My family did. And it's board game geek has a weight of 1.48, so it's a it's still a pretty simple game. I think Machi Koro is, like, 1.3. It's so, yeah, very, very approachable, simple game. Says age 10 plus can play it. My daughter's 9. I think she'd be fine playing this game.
Charles Max Wood [01:17:12]:
It says play time is 45 minutes. I'm not sure if I remember how long it took us. Probably about that long. So, anyway, it's it's a fun game. If you're looking for just something short, not terribly, complicated that you can play and kinda chat over the table while you play it.
Dan Shappir [01:17:31]:
Chuck, I'm kind of curious since you're such a board game geek slash expert. If you had to name your, like, top board game or at least one of your top board games, just out of curiosity, what would that be? 1 in the top 3 or top 5, please. So
Charles Max Wood [01:17:53]:
that's a little bit tricky just because there's so many kinds of board games.
Dan Shappir [01:17:58]:
Yeah. But there must be something you really like.
Charles Max Wood [01:18:02]:
So the ones that I've been playing a bunch lately, and I can I can give you a couple of them? I've already picked them on the show. No. Obviously.
Dan Shappir [01:18:11]:
I'm just curious which one you like the most.
Charles Max Wood [01:18:16]:
I'd really have to think about that. Like I said, the ones that we've been playing lately that we're really liking are Mysterium. We got expansion for that. It doesn't change the gameplay at all. It's just more cards. We got 2 expansions. The other one that we've been playing lately is betrayal at House on the Hill. I should put links to these in here.
Charles Max Wood [01:18:39]:
And that one's a fun one. It's it's relatively fast too, but it's more of a a role play game almost. The idea is you have your group of people that come into a haunted house, and you explore the house, and eventually a haunting happens, and you then you're trying to complete goals. One of you frequently becomes the trader almost always, not always, but almost always. 1 of you becomes a trader and then everybody's playing against that other player. And those the the thing that's fun about it is that the scenario you wind up playing changes from game to game. And so it's it's and the the as you explore a room, you place tiles for the rooms, and so your map changes every game too. And so there's there's a lot to like about that.
Charles Max Wood [01:19:32]:
Honestly, sometimes I really, really like the kind of the the thinker games. I'm not so some of the big big ones that people tend to like that I'm, I'm not a fan of are, like, 7 wonders or there are some of them where you're almost playing your own game, and then at the end, you see who played it the best. But you do interact with each other as far as did I do better at you with this than that. But then you've got other games. I'm trying to think. We've been playing risk legacy, which I like, but I don't love, with my friends. We played heat, and I think
Dan Shappir [01:20:16]:
I meant that risk is that play properly. It can take such a long time.
Charles Max Wood [01:20:20]:
Yeah. And we're getting to the stage with risk legacy. So risk legacy modifies the board every time and has special rules for how you win, and so it doesn't take as long. But the last time we played it, it's starting to get to the point where you really almost have to do world domination to win the round, and so it does take quite a bit longer. Yeah. I tend to like Settlers of Catan, that was one of the games that I kind of got into gaming board gaming on, but anymore, it's like, there are so many games that just have better mechanisms in them. And so, yeah.
Dan Shappir [01:21:01]:
If if somebody likes Catan and wants a better alternative, what would you recommend? Well, you need to think about it.
Charles Max Wood [01:21:10]:
Yeah. I do. Let let me I'll I'll I'll come back next time with my top 2 or 3 games.
Dan Shappir [01:21:16]:
That'll be your homework for next time.
Charles Max Wood [01:21:18]:
Yeah. But I will tell you that, yes, for the social games, we're we're really liking Mysterium. If you want a lighter, social game, things like Sushi Go Party are fun. If you're if you're looking at, like, maps and things like that, I mean, there are games out there. I kinda have this nostalgic feel for, access and allies, but that's another one that takes, like, 3 or 4 hours to play. Yeah. There there are a bunch of good ones out there. Let me think about that, and I'll come back to it.
Charles Max Wood [01:21:54]:
But To
Dan Shappir [01:21:54]:
be honest, I don't see myself playing a board game for 6
Charles Max Wood [01:21:59]:
hours. Yeah. The ones that I like, they take you about an hour and a half, and you have some idea about where you're at as far as, like, am I winning or not? But you don't entirely know because there's always some twist that you know? And so somebody could be building towards something, and you don't really see it until they resolve it. And then you go, oh, wow. Right? But then you turn around and you resolve your thing on the next turn, and then everybody goes, oh, now he's you know? So so those are the kinds that I like and the ones where I I have enough room to get creative on on the strategy. Right? Where there's not just kind of a tried and true, if you do this every time, you're gonna win.
Dan Shappir [01:22:42]:
Play go.
Charles Max Wood [01:22:44]:
Yeah. Go is a a good example of that, with fairly simple rules. So, anyway, other pics, my wife and I started watching Prison Break, which is an older TV show on Netflix.
Dan Shappir [01:23:04]:
That's an older that's on the nineties, I think.
Charles Max Wood [01:23:07]:
I think it's early 2000, but still, yeah, I've been liking that. I'm still watching. I have the last season of, what's it called? Reacher? No. Not Reacher. Jack Ryan. I've been watching that.
Dan Shappir [01:23:25]:
Yeah. I I tried to watch it. I couldn't really get into it. I I actually read some of the what what's his name? Clancy, I think he Uh-huh. Yeah. I read some of
Charles Max Wood [01:23:34]:
the books?
Dan Shappir [01:23:35]:
Yeah. I read some of the Tom Clancy books. I could never actually get into either the movies or the TV shows. I don't know. Yeah.
Charles Max Wood [01:23:43]:
They're older movies too. Hunt for Red October is a terrific book. Yeah. That's for sure.
Dan Shappir [01:23:49]:
That that's his best one, I think.
Charles Max Wood [01:23:51]:
Yeah. I've I've read a few, others of his books, but, the TV show is not based on any of the books.
Dan Shappir [01:24:00]:
Oh, yeah. I forget.
Charles Max Wood [01:24:01]:
They just pulled some of the characters out, and they basically have a new threat every season. That said, it's not the best ever kind of action spy TV show that I've ever seen, but I'm enjoying it.
Dan Shappir [01:24:17]:
If you've got Peacock, I would I I actually picked it a while back, but it might be nice for you to watch if if you've got Peacock. I don't know who has Peacock, but I do. Maybe. Then it's, Day of the Jackal.
Charles Max Wood [01:24:30]:
Yeah. You recommended that a few weeks ago, and that's kind of on my list. But yeah. Anyway, so I've been watching that. I'm in the middle right now, and I'm gonna pick these books again. I'm on book, like, 9 or 10 of the sort of truth books, and they they are so good. I I I've gotten so I read them in high school, and then I hadn't really touched them again. And so and he put out more books.
Charles Max Wood [01:25:01]:
The author had passed away a few years ago, but he he wrote, like, these good books and this yeah.
Dan Shappir [01:25:08]:
I recall reading some of his stuff. I'm trying to remember what. Yeah.
Charles Max Wood [01:25:15]:
Those were his
Dan Shappir [01:25:16]:
passed away.
Charles Max Wood [01:25:17]:
Big series. But, yeah, I, Yeah.
Dan Shappir [01:25:20]:
I see. He died, 5 years ago. 2020. Yeah.
Charles Max Wood [01:25:24]:
But, anyway, he's I've just been really, really enjoying these books. And so, yeah, I'll pick those as well. I don't know. I'm kind of rambling at this point because you derailed me with the question about board games. But, yeah. And then, just working on getting, JavaScript geniuses and the AI boot camp roll it out. So, yeah. Anyway, I guess we'll wrap it up because I am not going to keep rambling about this stuff.
Charles Max Wood [01:25:59]:
But, yeah. Till next time folks. Max out.
What's New in JavaScript: Latest Language Updates and Features - JSJ 666
0:00
Playback Speed: