Skip to main content
View on YouTube to comment and like!

about 1 year ago Syntax Podcast

5 Upcoming + Next Gen JavaScript Features

Wes Bos

Wes Bos Host

Scott Tolinski

Scott Tolinski Host

Topic 0 00:00

Transcript

Scott Tolinski

It's a screenshot from one of my exercises. Oh, I see. His oh, his not his his little not his avatar.

Wes Bos

own accord the car show with Top Gear. The Brits are gonna kill me that I had to even think about that. That's

Scott Tolinski

We have an pnpm error on the syntax site, Wes, that has happened

Wes Bos

And two or three or something like that, maybe we can start implementing this and bring it into your applications anytime you need to use all of these random to write it, and it's maybe the other one. The fail backwards. Struggle

Scott Tolinski

doing good, man. I've never heard of Y guy before. That's hilarious. Made that up. Yeah. Oh, let me just tell you, folks. We did a we did a live show in Denver,

Wes Bos

even just random number between

Scott Tolinski

There's even a neat AI feature that helps you fix the problems because you know that error logs and dumps can just be like, the Secret Lives of Mormon Wives and Vanderpump Villa and all this shit that's on Hulu.

Wes Bos

Of course. So the world is not not totally solved yet. Yeah. Next one we have here is array dot from async.

Wes Bos

No. There is no Python clamp. Oh.

Wes Bos

import module thing that just clips on top, converts USB c to lightning. That's good. And then it just dangles on it, and then you always at least have one And the first time that you encounter a key, like, let's say you're you're looping over a list of clothing and and you get shirt, shirt, pants. Right? The first time you hit shirt, you check.

Wes Bos

Kotlin, Dart, Ruby, Elm, which is deferring the import, meaning that it will download it right away, but it will not execute it until you call or until you use that code inside of there. So simply just pop a defer on the import statement. So it's import defer whatever.

Wes Bos

Yeah. That's great. You'd like, that you don't even need to carry around a MacBook charger anymore if you have one of these. And they're smaller, and they it fits in your you just put it in your bag, and you have charging for all your gear, including your laptop when you're traveling.

Scott Tolinski

JS has offered a very simple API for randomness, math dot random, which we've all used. It's a function that returns a random value of uniform distribution from Now we know what random is.

Wes Bos

on import. You might wanna wait until you actually need it and if you ever actually end up needing it. Yeah. And alongside that as well, there's another one for adding the deferred to If you have a generator function, or why do we need this? Now's your chance.

Scott Tolinski

It is Rob is

Wes Bos

when you have any in a synchronous you might not want that happening items

Scott Tolinski

And I think there's no reason why this shouldn't just be,

Wes Bos

APIs that the browser is is written in. So certainly is a performance thing when you get into very large if you're shuffling an array of 20,000 let's get on into it. Oh, I forgot to introduce you, Scott. How are you doing, Scott? Oh, I'm a Y guy.

Scott Tolinski

Palmer, who you did mention here,

Wes Bos

It it seems like the ultimate random toolkit, and We beat him out. Take that Python.

Scott Tolinski

You know what? I use an UPSERT mostly in database stuff. Yeah. Me too. In UPSERT, what it does is it updates the record if it exists, and it inserts it if it doesn't exist. That can save you doing a simple conditional saying, does this thing exist? If it does, then do this. Otherwise, do this. So an UPSERT can turn that into Node line, which is, typically how I'm using it. Some people

Wes Bos

The thing is that people are going to use this to create You're a Y guy? Now's your chance to take part of the standards process the card ran out or something. The card ran out. Our credit management is still pretty rare. AI summaries were not

Scott Tolinski

Yeah.

Scott Tolinski

randomness things,

Wes Bos

and wait for all of the items to be resolved

Scott Tolinski

just a rocket shipped into JavaScript because

Wes Bos

could then all of them into an array of their end values.

Scott Tolinski

and you're providing it a value of a 120

Wes Bos

No. No. No. No. That's not me. That's him.

Wes Bos

But once it hits, like, a stage

Scott Tolinski

to make sure that your application

Wes Bos

Neat. UPSERTs.

Wes Bos

and, and and stop it before it's too late.

Scott Tolinski

Wes gotta see,

Wes Bos

a a pub, and it's super interesting. The guy is absolutely,

Scott Tolinski

AI to write these things. It's weird. It's very weird. Yeah. I I don't like getting them. Alright. Back to random. Random is a it it most importantly, a new namespace

Wes Bos

will take an iterable, and and let's take a sec for explaining an iterable. An iterable in JavaScript is a piece of data or data structure that can be iterated over. It can be looped over. Right? And, obviously, arrays are probably the the most simple, intensive.

Scott Tolinski

Your credit balance is too low to access the anthropic API.

Scott Tolinski

for for math. You see it a Scott. And they say, see the p five JS Deno. You see it a lot in stuff like p five. Again, when you're working with numbers and you need to constrain them to different times. So, yeah, this this exists everywhere. There's a ton of user land implementations.

Scott Tolinski

I was gonna say,

Wes Bos

I hate having to write that. Like, Netflix and Disney and and Amazon Prime and Discovery.

Wes Bos

I feel like I can smell it a 100 miles away be nice. And working with streams as well, I think this will be really helpful for as well, Rick. I don't care about every single hunk. I just give me the end piece of data that comes out the other end.

Scott Tolinski

you know, it's a cron job. Like, are you checking your logs to whatever to see if a cron job failed or passed? I mean, I'm sure you might notice it stopped working or something like that. But now we can see that this has happened 2,000 times since, May 27 that we can take care of it. There's also a new feature here called SEER,

Wes Bos

Coxwells

Scott Tolinski

and it does so in a wonderful way by really giving you all of the data.

Wes Bos

So if you need it for that, then then you should. People are a little up in arms about that not being cryptographically get me this value, or if it is not there, then insert it. And the first or the second argument to the method is going to be the default value.

Wes Bos

Right. And I don't wanna do that in JavaScript. You know who's very fast a random API.

Wes Bos

because you should probably use be using a map anytime you're doing any sort of dictionary or collection work. Maps are are kinda underused, and I think one of the big reasons is because it's you can't JSON you haven't reached the end of it. That is take that. Yes. Yeah. Alright. Let's get ESLint some sick picks and shameless plugs. I got a sick pick for you today, and that is a TV show that me and my wife have been loving, Clarkson's Farm. Jeremy Clarkson.

Wes Bos

writing her emails, The lower level, algorithms that are much more computationally There's a couple things you can do to make your your app more performant. Right? You cannot

Scott Tolinski

Wes, your brain is fascinating to me. Yes. Yeah. Also fascinating, my website, because it doesn't work very well because I'm not checking my errors enough on century.io.

Scott Tolinski

You can get a random int if you if you wanna specify it as being an int or a big int. I like this random, dot Boolean

Wes Bos

And the most common use case will be when you Yarn, like, counting through items.

Wes Bos

if you want to do them all in cities and whatnot, when you're writing tests for those, you often need those values to be the same every single time because if there are random values every time, your Wes would Node never pass.

Wes Bos

truly random backwards.

Wes Bos

Yeah. Yeah. That's it's it really has thought of everything. I went went through it. I made examples for everything in here, and it really makes sense. It is not importantly, it is not cryptographically iterables and generators, and this array dot from a sync will But with the, like, random one, derive the random values from that in a way that you're saying. So So you can just load it as a parameter.

Scott Tolinski

a normal USB on there. And this thing has this is a charger with a screen.

Scott Tolinski

you know, point zero one or whatever And what JS CLAMP? And, honestly, Actually, that's not true. I do. I check it all the time, and my website works absolutely fine because of that. Century is it's the perfect place to

Wes Bos

But, then on the thing I have a couple cables that have it built in. It's so, so key

Scott Tolinski

comparatively

Wes Bos

Yeah. All all of these methods are are very polyfillable, being able to see the actual draw Oh,

Scott Tolinski

which is hey. That's pretty cool. So some either one of them is listed as random, as the random method. So are you gonna say random dot random?

Wes Bos

So you know array dot from

Scott Tolinski

in all regards, and one of those ports does up to, I think, maybe even more of them. I think two of them might do a 140 watts. So they they have, like, one yeah. A 140 watt and then a 140 watt and then a 40 watt and then a USB, Sign up with the coupon code tasty treat, all lowercase, all one word, get two months for free. Alright.

Wes Bos

or the most common Node, but, there's many other types of data in JavaScript that can be looped over. Right? You can loop over objects you'll know that you'll get the same value every single time that you call it. So if I call random dot random, it's always gonna with a certain seed, it's always gonna give me 0.4 May 27. Two weeks Deno Pro.

Wes Bos

And freaking half the time, I can't even find what I want, or it's, like, covered in ads. So definitely check out Streamio. Very good. Okay.

Wes Bos

which module The method name here is called npm package that's installed, like, a 100,000 times a week and just because it's it's annoying to to have to do that.

Scott Tolinski

Yeah. I have not seen. Yeah. And I I I like him in general. I liked, like I said, It's the Anker 22

Wes Bos

So I have I have this one, which I sick picked years ago. It's the a very handy use case for But then some cases, you do want it. Right? So it's taking that all into account. Random weighted, where you can weight certain items that are $214 And then you wait until it will the browser will simply just wait or the JavaScript runtime will simply wait until you actually need to use that code

Scott Tolinski

Yeah. Yeah. It's been I have I have one old iPad that the kids use that uses the the, Take

Wes Bos

But the the other part of JavaScript is not just loading or downloading the actual JavaScript. It's it's actually executing. It's the browser needs to parse out the entire JavaScript

Scott Tolinski

and Wes was a part of a panel.

Wes Bos

predictably random every single time. So if you've ever used, like, a faker JS or to tell if something is dead or not, especially if you, like, have, like, an iPad. I've I've fixed a few iPads in the past.

Wes Bos

random, it took quite a quite a long time. Right? It turned out to be a bug. But if you have some very big code, shoot. We gotta fix that. I know. Not the 5,000. Oh, yeah. Actually, no. We have a cron. Yeah. We have a cron. The Bos the way that that works is every five minutes, it checks if there's something that needs to be Have I have I started counting shirts yet? No. Okay. Now create a key called shirt and set it to zero. Then you hit it again. Okay. Well, now it exists. So I'll grab the value out, and then I'll increment it by Node, and then etcetera, etcetera. Right?

Scott Tolinski

shitty ads. I was we were we were laughing that the ads are so bad on Hulu that Syntax could

Wes Bos

that's such an annoying thing to have the object,

Scott Tolinski

crappy iPhone.

Wes Bos

we have immediate importing and immediate execution. That's just a regular import. We have lazy loading, which is a dynamic import.

Scott Tolinski

Vanderpump Villa, which I gotta say, Hulu.

Scott Tolinski

trusts that I'm going to well, people trust me because I do it every year, and I'm always fair about it. But, like, I wanna have some verification that I didn't just pull these out of my ass. So I just take, like, a screenshot of them after I do it. But, like, if you could share links with the seed,

Wes Bos

it it can be expensive. Like, I've had some I've had some code, like, on a Cloudflare worker that took every time you instantiated entertaining, so I would highly recommend it. I think it's on Amazon Prime is where we watch it.

Wes Bos

Mhmm. So that's so so good to be able to see the actual pull.

Wes Bos

C is plus plus anytime any of these new features come out, you always get these guys that are like, woah. That that API sucks,

Scott Tolinski

Yeah. Node one thing that is nice about this is it does seem like it's very polyfillable.

Wes Bos

I think we either have to update it or the

Scott Tolinski

it could be a a steamy dump. I'll tell you that. And, Sentry allows you to click a button and it allows you to parse that in a nice way. It allows you to then connect it to potentially logs In CSS, these are in a different order. But, hey, you take a number, a minimum, and a maximum.

Scott Tolinski

Man.

Wes Bos

stream decoder on it. You know? I will tell you that.

Wes Bos

and they go through the different stages. And as they move along, some of them are are stage zero. They're just wacky ideas that'll never happen, and then some of them are are stage two to 2.7, of, generated, like a Yes. An AI summary. And then it it pings the anthropic API. So it's it's probably happening every five minutes for don't like upserts, but I pnpm to they don't bite me. I don't I don't know why. I've never had them bite me. Yeah. So much of my coding is simply checking if something exists. And if it exists, then I want to update it. And if it does not exist, I want to then create it with that value. So this proposal here is for adding UPSERT to maps and weak maps.

Scott Tolinski

championed by Tab Atkins.

Scott Tolinski

these two bounds. Yeah. This is endlessly useful for animations, they must be charging nothing for them because Syntax could could reasonably have a better ad on Hulu than any of the garbage that's on there. It is crazy, and they make you sit through so many of them, and we're paying for it. It is like

Wes Bos

the double emoji in, like, a tweet or at the end of a sentence is a dead giveaway that you're using ChatGPT

Scott Tolinski

for who knows how long because there's, I love that the way these things are written, to be so formal. I'm such an informal Vercel. The whole spec authoring thing is a is a world of its own.

Wes Bos

the JavaScript from that tag, but it will wait until,

Scott Tolinski

Man, I cannot believe how bad the the Hulu apps like,

Wes Bos

I got this it actually executes it, which can any one of these APIs that creates random names Yes. You could share the seed.

Scott Tolinski

a car show.

Scott Tolinski

which is in beta. It allows you to find the root cause of an issue. And you just click that find root cause button, and it's gonna attempt to figure out what the root I have I have a feeling I know what the root cause of your credit balance is too low here, but there's some errors that I I don't think I'll be able to find that. And so shout out to Century on that. Head on over to century.il/syntax.

Scott Tolinski

This is specifically why I bought it. Because when I was in Barcelona,

Wes Bos

immediately You can grab a random item from an array.

Wes Bos

Plex player, with a four of. You can loop over strings and get every single character.

Scott Tolinski

I I Wes, how could this possibly be about colors? It's black and white. Next one here

Wes Bos

nine, and, but, like, man, I just got an array of names I need to shuffle. You want to be informed? Necessarily. I'm not using this to create passwords.

Wes Bos

when you're, I don't know, putting out some new syntax token or something like that, it's gonna be you're gonna get stolen from.

Wes Bos

every single time that I call it in that instance. But then I call it again, it's gonna give me that same number. So it's predictably

Scott Tolinski

or see exactly what happened in a session replay.

Scott Tolinski

typically, it it takes a number, it takes a minimum, and it takes a maximum.

Wes Bos

doing a random number between x and y, a random number with a step. So you could say, like, give me a random That's great. Number between two and three with a step of point one. It might give you 2.1, 2.2, 2.3.

Wes Bos

at Walmart, but you gotta run Yeah. You so you would randomly generate a seed, and then that seed would then be shareable. And then anybody else on their certainly in, like, tree walking, a lot of times in Node. Js, you're doing directory traversal. You're searching for something. You don't necessarily know Mhmm. Meaning that you should not use this for things

Scott Tolinski

This can be useful if you have, like, an animation that needs to happen from zero to 100,

Wes Bos

he always whenever anything interesting JS happening at t c thirty nine, he's posting it up. He's on on Blue Sky as well. So Oh, he is. Certainly of all the end values in there. So that will be handy one. That's not something I run into all of the time, but upcoming and coming very soon JavaScript features. So t c 39 has a proposal stage

Scott Tolinski

So you can get a random Boolean, and it, by default, is weighted fifty fifty, but you can weight it. You can weight it so it returns true more often than 70. Percent of the time. Right.

Wes Bos

and looking like they're going to make it. So we're gonna talk a little bit about what they are and and where they would help you out and and kinda what you can look forward to, And every single time that you loop, you get the next item from the generator. So until you actually need it. And that's like lazy loading. Right? And you can dynamically require just started and then share that seed.

Wes Bos

My kid's teacher by watching the wattage spike and go down, you can tell if it's if it's, like, short circuiting.

Wes Bos

Peace.

Wes Bos

and,

Scott Tolinski

returns Oh, yeah. A Boolean.

Wes Bos

like generating private keys or tokens or anything like that. There are web crypto APIs for that, which use

Scott Tolinski

I have one international adapter, and I got one thing I can plug into it. I can charge one thing at a time. So I got this to to load up my stuff for my Amsterdam trip.

Wes Bos

Maps and sets can be looped over. Node lists warp if you query Vercel or something, that's not an array. That's a node list.

Wes Bos

you may want to use the array dot from a sync. And what that will do is it will take an iterable, which has a sync values in it, and then it will spit out just a straight up array

Scott Tolinski

potentially, Yeah. Now we got, a clamp proposal in JavaScript, which is at stage I brought a bunch of chargers, and half my cables didn't work. And then I realized, oh, I only brought one international adapter. So, therefore,

Wes Bos

You shouldn't have the same person twice.

Wes Bos

like, I guess, like, if you're thinking about performance on a website, maybe we'll we'll step back a bit.

Wes Bos

reexports, which is when

Scott Tolinski

which is very odd, I thought clamp was already in JavaScript. It it turns out I've always just been, writing an implementation of it every single time or, in text messages and emails, and it's, like, very bad?

Wes Bos

okay. So we probably have, like, eight shows and he was telling us about, like, what's built in JavaScript and and what's native. And that's a very interesting world and seems like a very painful world to test random TVs And Welcome to Syntax. Today, we've got an episode for you on next gen

Scott Tolinski

is I got a

Wes Bos

We gotta beat Python out.

Scott Tolinski

no shade on the developers because I'm sure it is a

Wes Bos

We've used UPSERTs for for many, many years. When have you when have you used an UPSERT? random

Scott Tolinski

I love Wes has a Node says, Scott, you love CLAMP in CSS. I do love CLAMP.

Wes Bos

in my case, I've only needed that for for testing. Have you ever ever need predictably random and anything else?

Scott Tolinski

I I that sounds great.

Scott Tolinski

Yeah. And then you could derive the random list the same way every single time without having to save the order of it. Yeah. Yeah. It's it's a seed that you save. You know what would make sense about that? Every every Yarn, we do, you know, like, football squares, and I have to do them, like, randomly. And since I'm I'm the one doing them randomly, nobody,

Wes Bos

with a defer to go and grab a utility method for it or or whatnot. So I'm very excited about this. I will say even, like, the even as as far as, like, the random, It's the, like, every single color every single, like, named color in HTML.

Scott Tolinski

And the guy could not stop coining new terms to the point where people were buying domains in the audience JS he was talking.

Wes Bos

ten and forty,

Scott Tolinski

within JavaScript.

Wes Bos

where people will propose ideas to add to JavaScript,

Scott Tolinski

two.

Wes Bos

the end to actually go ahead and and execute it. And the proposal for

Scott Tolinski

USB Bos For sure. CLAMP is wonderful.

Scott Tolinski

12 times a day

Wes Bos

Interesting.

Wes Bos

It's annoying. I guess so odd. It makes more sense because you can just, like, do a quick bullet list of what needs to happen, and then they you feed it in, and it makes us, like, flowery email. But it's just to say, like, if it's there or not. So it's just another nice little one. It will not be added to like, not dialed, but he's a lot smarter than he leads on.

Wes Bos

So, by seeding something with random, on it. This is kinda interesting. So right now with the script tag, if you pop a defer on the script tag, what will happen is the browser will once this moves forward, I certainly would not use it yet.

Scott Tolinski

Lodash, Three j s, p five, Phaser. Like, anything like that uses clamp. And and I've written my own clamp a number of times because it's not not that tough. Mhmm. But It's a one liner. Right?

Wes Bos

Yes.

Wes Bos

stream.io because I I'm I'm the same with you. I we pay for, I don't know, probably six or seven of these, that are getting pinged every five minutes. And something happened with the Anthropic API.

Wes Bos

once they have that. And it's it's I I just off the top of my head, I was like, this is called struggling backwards. Meaning, like, you just get into it, and then you realize you hit a problem, and then you have to, like, struggle through it and learn how this stuff actually works. And everyone's like and then, like, the rest of the panelists are like, mhmm. I really I really agree that you should struggle backwards. You know? And, like, I was like, guys, I just I just made that up. That's Scott, like, a thing that we have. And then someone bought the domain name.

Scott Tolinski

Scott's always CLAMP and everything here and there. Yeah. Insert the, I love CLAMP. I love CLAMP.

Wes Bos

Random Scott, and there's 22 methods on there.

Wes Bos

a very good follow. And his profile photo

Scott Tolinski

Plex has got a much better app than Hulu does. So shout out to Plex for doing what Hulu can't do with whatever their budget is. That's the end of the Hulu rant, folks. Sick pick for me today

Wes Bos

I got it stopped working so many times you have to check if it's there. I do all this wacky shorthand

Scott Tolinski

T c 39.

Wes Bos

proposals and and kinda where they're at. The first one we have here is, From an array. You can say, give me three items from this array and repeat them if if you hit them multiple times or or don't. Like, I've done I've written that many times. So you have a list of people's names. Yeah. You wanna grab three people.

Wes Bos

download all of the, it is absolutely wild. I gotta put you on to stream.io. That's that's all I'll say JS is go check out recently because I'm almost there. My phone is is lightning, which I'm almost I'm I'm waiting for the next Node, and my keyboard is lightning, which kills me because I'm this keyboard is gonna be around for years.

Scott Tolinski

Yeah. It's great. There wasn't even another one too. I was I was just like I forget what in the audience, and I was just like, god. He's doing it again. And every time you you got called on for something, I was just like, that is a, another term coin. So,

Wes Bos

to generate the seed.

Wes Bos

There's probably no way for you JavaScript that is needed So you can shuffle an array.

Wes Bos

get or insert, which will basically say, four, and then we actually have them in the browser. So there was last week, there's a whole bunch of new proposals that have moved forward you sometimes want to simply just convert how many items there will be in that iterable because you import and export something in a single line, there's another proposal which will allow you to add the deferred value to those, but it's not really that. It's you'll you'll need it, but it's not super interesting, so you won't spend any time on that. Yeah. By the way, if you if you do wanna keep up on a lot of this stuff or or really if you're on Twitter,

Scott Tolinski

So the the general idea here is that,

Wes Bos

as well as, like, give you a chance to,

Scott Tolinski

I know. I I asked, I know this is stupid, but I asked Chad g p t to write Courtney a thank you for my salad in a formal way. And it was like, dearest wife, thank you so much for this yummy salad. And I I did say you need to use the word yummy in it. And and she was like, who wrote this? You didn't write this. Oh, man. Yeah. Obviously, ChatGPT wrote it. It sounds the most ChatGPT thing ever. Side note double side note. Do you have people in your life that use ChatGPT It sucks. The apps suck. You pay for a service, and then you gotta watch 10,000

Wes Bos

whenever you're unsure if if a device is charging or if it's charging fast enough or whatever, is that you can download something that is random is you want them to be defer Node than others, which is kind of cool. There's a whole thing for random distribution.

Scott Tolinski

or, like, int.

Scott Tolinski

It is awesome.

Wes Bos

And the idea with seeding

Scott Tolinski

or something like that. And this is going to make sure it doesn't go above that upper bounds. And, likewise,

Wes Bos

everyone, is a dead giveaway that you're using, unfortunately, because I'm a m dash enjoyer. I probably don't use it in the right ways.

Wes Bos

stringify it without a, like, a custom

Scott Tolinski

bureaucracy thing. But, like, man, Netflix

Wes Bos

so you could

Scott Tolinski

yeah. Why do we need all these user land implementations of this when we got it Yeah. Even in CSS? He was just like, we put we put, chocolate on a pizza and call it Treatza. And everybody's like, oh, Treatza. Come on. Treatza. Or

Wes Bos

Alright. So we're gonna go through all the different,

Scott Tolinski

USB c charger four port multi device fast charging advanced GaN power adapt and intuitive tech controls for MacBook, iPhone 16 series, Samsung Galaxy Vercel, and more. It's Anker. It's very nice. It has a little screen on it that shows you how much each device is drawing.

Scott Tolinski

randomness

Wes Bos

And it's annoying.

Wes Bos

and he's starting up, like, random, similar to how sometimes you wanna simply wait for, like, promise dot all Scott, of

Scott Tolinski

on the TV app like, you can't complain that the TV's underpowered or something like that because the Netflix app Right? There's Clamp inside of,

Wes Bos

if you want to asynchronously Yeah. I guess you could just come up with seeds until you found one that was your name first

Scott Tolinski

that seed would provide a proof that, that exists as a thing that we did.

Scott Tolinski

great follow for this. He's always tweeting out about whatever's going on. He's a cochair of t c thirty

Wes Bos

It's beautiful. And, like, he's got animals, charge things.

Scott Tolinski

is the random random Node space and functions. This one is stage zero, Max

Wes Bos

takes up CPU, and it can make your app

Scott Tolinski

Node. Clamp clamp JS in CSS before we got clamp in CSS before we got it in JavaScript. Yeah. You're right. It's a function that constrains a value between an upper and a lower bound. So, basically,

Wes Bos

you can loop over those.

Wes Bos

very good because we have Randy now, and we're just gonna stop putting the AI summaries in there because Randy's summaries are better. There's also a, new feature in here in the this error, which shout out to Century here because, inside of them.

Scott Tolinski

And, yeah, shout out to Anker, always making the good stuff.

Wes Bos

iterable, synchronously,

Scott Tolinski

The next one here is Clamp.

Wes Bos

a high performance four k He's the guy from like, there's double emojis at the end of every sentence, and that's, like, dead giveaway. You the em dash, Wes people Yarn asked, like, the the same question all the time. It's like, should you learn the basics before you get ESLint deep? And, you know and I was like, I don't really believe that. Like like, I learned jQuery, and then I learned JavaScript. I learned a lot of people Yarn React, and then they learn regular JavaScript. And a lot of people are now AI programming, vibe coding, and then they're gonna they're gonna learn how to actually code properly,

Scott Tolinski

let let's even read this first paragraph. Historically,

Wes Bos

the British countryside.

Scott Tolinski

Top Gear. So maybe give them a no go. We've been watching just absolutely trash trash TV lately. So

Wes Bos

stringify algorithm, in JavaScript.

Scott Tolinski

events of this or 10 2,000 events of this. What what's the error?

Wes Bos

Python. Does Python not have clamp?

Scott Tolinski

20,000

Wes Bos

so that it understands what the methods are and and everything. And if there's any code that needs to be run right away Wes that thing is is required, then or imported, then that will run. And that execution

Scott Tolinski

for

Wes Bos

I guess, is a stage Node, three, to to be able to

Scott Tolinski

Oh, man. Like,

Wes Bos

Yeah. I love it. One thing that is comes along with this proposal is another proposal for a seeding algorithm.

Wes Bos

And that will be

Scott Tolinski

is working,

Wes Bos

And Yes. Well, random dot random is going to be the, like, existing random that we already have. That's not very exciting. But I'm just wondering if that's the way that Yeah. Random dot random. Super random. But the rest of them are for Wes when somebody's using

Scott Tolinski

smokes it, Because they're always long numbers. I mean, it would be tough to work backwards from a seed. Yeah. I'm sure there's ways you could do it. But, like like, I think about, like, Minecraft has seeds. So, like, if you create a world that's really cool and you want somebody else to be able to then be able to create that same world on their own, so it's not like you're joining the world, but it's, like, recreating it. They do that via a seed. Oh, yeah. A lot of games use seeds in that way.

Wes Bos

is of one of my JavaScript exercises, I just realized. I'm very happy about that. In this guy or on Twitter? On Twitter.

Wes Bos

run them, but you want them to run-in series, A a question I often get whenever I post about these things, specifically the random one, are people like, why do we need this? Mhmm. Like, why why are we adding all this stuff to the to the language, and, like, why not just import a module? And it is extremely Okay. Yeah. I can get with that. Beautiful. Alright. That's it for today. Thank you so much for tuning in, and we will catch you later.

Wes Bos

I guess if you need to be able to reproduce a list If you need to reproduce a list saving it. Like, just say you have a list of names. You could save the seed.

Scott Tolinski

trash TV as a genre, I'm gonna say. Okay. Like like what?

Wes Bos

functions and and doing lots of complicated math in random land. And then simply things like CLAMP or it's a one liner, it's just so much simpler But there's also methods for random arrays.

Scott Tolinski

you go less than zero, it's gonna return zero. So it's gonna keep it in between Rob,

Wes Bos

to have it built right in. And, like, it that's that seems like a standard standard lib thing that everyone every language should have. It's a low hanging fruit. It exists everywhere. Just give it to some JavaScript. What else? CSS is Clamp. C warp has Clamp.

Wes Bos

That's great. Are you in your are you full USB c in your whole life? at moving around data pointers?

Scott Tolinski

in in every single regard. Netflix. Shout out to Netflix for actually,

Wes Bos

slower. So

Scott Tolinski

You know I'm doing

Wes Bos

In some cases with the clamp one, people will be like, why not just write a one liner where it's like math dot max? And I hate writing one liners. You have to have, like, a utils folder or your npm install. Like, I have a one liner And now we are going to get it at a stage 2.7, Yeah. I I actually started watching Top Gear after I watched Clarkson Farm. I was like, oh, this is actually pretty funny. Yeah. I like Top Gear. Yeah. But Jeremy Clarkson JS the guy from Top Gear, and he bought a farm in the Coxwells

Scott Tolinski

the number method here, like you said, having a step, but that, like, allows you to, again, have a step of

Wes Bos

iterables can also be asynchronous, meaning that you can await So, taking their engineering seriously. There was a guy at the meetup that worked on the,

Scott Tolinski

And what that does is say, like, alright.

Scott Tolinski

four port charger.

Wes Bos

And then probably the biggest one is is, like, generators.

Wes Bos

Yeah. Wes beat him out.

Wes Bos

So I got this little, Torrent streaming. It's like a network experience with, like, a torrent back end. It's just instant.

Wes Bos

IDs or random passwords.

Wes Bos

arrays or no. Arrays doesn't make sense. It's not added to objects, but I'm a big fan of maps.

Wes Bos

before

Scott Tolinski

It's on Hulu. Hulu sucks.

Wes Bos

And

Scott Tolinski

I will I will check that out because

Share

Empowering developers for over 286200266750 milliseconds!