ES7 which was introduced in 2016, is very very easy to grasp.
Why?
Well, because unlike ES6 which had a lot of changes.
ES7 only has two additions to the language. In this video,
I'll go through both of them. The first one, we're going to talk about is the 'includes' method
that was added on strings and arrays.
Let me show you.
I can do something like "'Hellooooo'.includes", And I can say, 'o' and if it includes 'o', I'll get a true.
We can also use it on arrays.
So for example, if I had an array, let's call it 'pets' and in the 'pets' I have a 'cat', 'dog' and a 'bat'
I know that's a weird pet.
But sure there's some bats pets out there.
All right.
And now in here, if I do 'pets.includes('dog')'.
Well, if I run this, in the console, I get true, if I do 'pets.includes('bird')', I'll get false because it
doesn't include bird.
Very simple.
That's it.
That's one of them.
And then the second one is the exponential operator.
So if I wanted to have a function that let's say 'square' something, I can do
function 'x' is 'x star star 2' and that means 'x' to the power of two.
So again, if I run this and then I do 'square' of two.
Oh! and I cannot spell.
Let's try that again, 'square' two.
I get four.
I do 'square' of five.
I get 25.
If I wanted to expand on this and do a 'cube',
Well I can do 'cube', will have 3, exponential 3.
So again and by clearing this, just to make a bit of space and I do 'cube' of three, I get 27, 'cube' of 4 is 64
and that's it.
Isn't that nice?
ECMAScript is going to be releasing small incremental changes every year, so it it's easy to stay on
top of language and avoid scenarios like ES6 where all of these changes were made and people had a hard
time learning all of them.
Now, with these simple two things in your tool belt,
go and practice them and see you in the next video.
Buh-bye.