How do you select the last child of an element using pure JavaScript?

  • lastChild
  • element.lastChild
  • lastElementChild
  • element.lastElementChild
To select the last child of an element using pure JavaScript, you should use the lastElementChild property of the element. This property returns the last element among the child elements of the specified parent element. The other options, lastChild, element.lastChild, and lastElementChild, do not provide the same functionality.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *