jQuery first and last methods
There are also separate methods first and last to select the first and last element of a set.
Let's consider the work of the above methods using the following paragraphs as an example:
html<p>text</p>
<p>text</p>
<p>text</p>
Let's find all the paragraphs, then select the first one from those found and assign it the text '!':
javascript$('p').first().text('!');
Now, let's choose the last one from the found ones and give it the text '!':
javascript$('p').last().text('!');
Задание 1
Find the first li in the set and color it red.
Задание 2
Find the last li in the set and color it green.