Now last but not least,
let's see how we can move elements around
so how we can move existing elements,
because that's also sometimes something you want to do.
And we only have these two paragraphs
and their links at this point.
And let's say, we simply want to switch order.
So let's say we want to take this first paragraph
and move it off after our second paragraph,
so that the two effectively switch position.
For this, we need to get access to this first paragraph,
and we already did do that here.
So I will use this first paragraph variable again,
and then we will basically just do something
which we already did before
when we inserted a new element.
I will select the parent element of the place where I want
to insert the element that should be moved.
And then we can call append or insert before
to insert this element that should be moved
in some place inside of that parent element.
So here,
since I want to move the paragraph
after this other paragraph,
I'll select the body since this is
the parent off the place where I want to insert it,
and then I will just append this first paragraph into body,
which will then effectively insert this paragraph
at the end of all the elements inside of body
and therefore after the second paragraph.
And since I'll be doing that on an existing element
instead of a new element,
the browser will automatically remove the element here
and move it to the new position.
So I don't need to delete the old element,
instead the browser will move it for me.
So here we can say first paragraph dot parent element,
which is the body,
append first paragraph,
so to append the first paragraph at the end of the body,
which is the parent element of the first paragraph.
If we save that, then you see indeed, this
I'm new this leads to Google paragraph
is now the second paragraph appended
at the end of body here.
And that's how we can move elements around.
You can move them around by selecting
the parent of the place where they should be inserted
and then using append or insert before there
to insert the element there in that place.
And with that, we now know how to add elements,
how to remove elements,
and how to move elements around.