Welcome back, everyone.
Now I have some good news and some bad news.
Let's start off with the bad news.
The bad news is that in Yes, 2021, which is the latest version of JavaScript, the changes to the
language there aren't that many.
There aren't that many new, exciting features you can Google East 2021 features, and a lot of them
are obscure features that most likely you won't encounter in your day today.
Now, the good news is that while you don't have to learn a whole lot of new features, as a matter
of fact, there's one important one that I'm going to show you in this video, but that's it.
Nice and easy.
Isn't that nice?
Nice.
Quick VIDEO.
So let's see how quickly we can do this.
Let's say I have a string here.
I'll call it SDR for string.
And Oh, I like this one.
The XHTML is the best of the best.
So let's make that into a strength, so our strengths as ZM as the best of the best.
I'm a little bit biased here.
Well, let's go along with it.
So with a new feature in Yes, 2021, we have something that we can use on all strengths.
It's a method that we can use on all strengths.
So if I do the string dot replace, oh, look at that, it already pops up, replace all what it does.
It allows me to replace something inside the string.
So let's say I want to change best in the string.
So let's say best and I want to change that to worst.
So if I replace that string that I get, Zeitoun is the worst of the worst.
Well, that's a little bit rude, but that's what we got with replaceable.
If I do string here.
Zeitoun is the best of the best, and that's because we didn't really assign this to anything the original
string remains.
But the new string, so I could have done something like this.
I could have assigned it and I could have said Konst, be equals.
This and now be is XHTML as the worst of the worst?
I definitely don't like this one.
I like the other one better.
Now that's it.
Yes, 2021, this is all we really got.
I mean, it's pretty nice to have a fun little side effect.
JavaScript actually used to have something called replace already.
So we could have done cost, see, shrink and replace.
There used to be part of all JavaScript, so it's not anything new.
But with this one, the problem with this one is it only changed the first instance of the word.
So you can see here is ITM is the worst of the best.
A little bit better, but definitely, definitely not the best of the best.
So anyway, fun, little fact, fun, little tidbit.
Yes, 2021, we have this replace.
Oh OK.
I managed to make this video way too long for what this really is.
Pretty easy, right?
All right.
Go grab a coffee and I'll see you in the next one.
Bye bye.