Yes, six allows us to work with iRace in kind of a different way.
There are new features released in ECMAScript 2015 that actually makes our job much comfortable and
easier.
So in this lecture, we're going to be talking about changes that we have in ethics regarding our rights
before we actually start and write some examples.
Let's take a look on indexed on file.
I have created you will element with some list items simply I have a your ABCDE.
We have some starchier and also I've created a class which I will use a bit later.
So you see on the page for nicely designed list items.
And the first thing that I'm going to do is to select those list elements.
So create a variable cost and allies and assign to it documents that and use your gut elements by Takanabe
method.
And insert here, Tognum Elai.
Then run in council variable Ellyse.
So here we got a collection.
I'm sure you remember.
What does it mean?
Actually, my collection is an array like object, it looks like is array items in that collection have
index numbers also.
It has length property.
But again, it's not array, it's an actual collection in document object Model S. We have talked about
it, but I'm going to remind you that we cannot use our Ableton methods with estimate collections.
For that, we have to transform them into arrays.
And in order to do that, we were using a right that from method.
Actually, it's yes, it's a feature.
We used it in advance because in iOS five, we can transform a collections into arrays in kind of a
difficult way, which then would cause confusion and misunderstanding, because in that moment you were
not familiar with advanced JavaScript concepts.
But at this point we can feel free and use this approach.
So in order to convert Estima collection into array, we have to use the following tweak, create new
variable constant Elyse array.
Then we have to assign to this variable array dot prototype write.
That prototype is an object which contains all built-In properties and methods of error.
After that, we have to access on array slice method.
It's first time when we use this method, but there is nothing difficult.
It works in a very simple way.
Generally, slice method copies a piece of array.
It takes two parameters which indicate beginning and the end of eRate, but without arguments.
Slight method just copies the entire right.
So we have access on a slice method and now we need to use call method in which we have to indicate
on which object has slice method to work.
You can imagine that slice is a regular function and we change on which object you point.
It's partial.
This variable in simple words slice method assumes that this Actimel collection object is an array because
it's actually index based and also it has length property.
So without any problem slice method, the returns are right.
Let's insert inside call method ice and that check and castle, what we have, right, cancel that log.
Elyse Ouray.
Reload and they say that we have here a right.
I know that all of this stuff is a little bit hard to understand, and that's why in Essex version,
we have a great solution, which you are already familiar with.
And it's a right that from it allows us to get rid of this little bit difficult stuff and instead of
it.
Right.
Just from reload and see that we have again a right here.
All right, let's remove Castle dot log.
And also, we don't need this variable in order to make our example more interesting.
I'm going to use your foreach array holper.
Actually, we can do it because Elice variable is already converted into array.
I'm going to make those boxes dynamically changeable on click event.
So that's why I have created class changing extremophile.
Let's attach event listener to each list element.
So as current item insert here I.
Then use Arrow function and that set event listener with click events, right, ally, dot at event
listener that click event.
Again, right here function so unclick, we're going to assign it to list elements, last name change
and for that right I class list in order to change dynamically style of list elements, I'm going to
use here Tuggle method, which actually assigns and then removes class from elements and as an argument
right to your class name change.
Reload and then click on items you see that we have here, little nice effect.
All right.
Let's go ahead and talk about next feature of ethics, which is far off statement, it actually raised
through every items.
And besides that, it also works with array like objects like XHTML collections now at least, and so
on.
Using false statements, we can achieve the same results that you have seen just minutes ago.
Let's comment this cold out and write for then inside parentheses declare a variable which actually
should be current item from ELLYSE collection and then we need to keep it off.
And also the collection itself so far off will iterate through Ellyse items and will execute the code
inside code block for each item that's copied these two lines and Pasir.
Reload, click on at least elements and see that we have some nice effects.
OK, that's a notice for a statement is expressed in very simple way, we don't have to use here some
complicated conditions.
We just have to use those two key words for and of.
All right.
And just like shall we have introduced the changes in ethics regarding race and also you have learned
how far of statement works.
See you in the next video.