First and Last Child
First and Last Element Child
Element traversal properties move between element nodes. firstElementChild and lastElementChild ignore whitespace text nodes and go directly to the first and last child elements.
This is useful when the structure matters more than a global selector.
Your task: Select the onboarding list. Add is-first to its first item and is-last to its last item.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
First and Last Element Child
Element traversal properties move between element nodes. firstElementChild and lastElementChild ignore whitespace text nodes and go directly to the first and last child elements.
This is useful when the structure matters more than a global selector.
Your task: Select the onboarding list. Add is-first to its first item and is-last to its last item.