Original code:
/** * @param {HTMLElement} parent The jQuery object wrapping the parent * @param {string} relativeName The name of the relative to be searched * @return {HTMLElement} The jQuery object wrapping the closest relative */ function closestRelative(parent, relativeName) { // Implement function here return null; } // Example case $('body').html( '
' + '
' + '
' + '
' + '
' ); let parent = $('James').eq(0); let relative = closestRelative(parent, 'Mike'); console.log(relative && relative.prop("tagName"));
Dashboard
Start Trial
Sign In
Home
Tour
Tests
Questions
Pricing
Resources
Blog
Read Evidence-Based Hiring
Support
Use Cases
ROI Calculator
Integrations
Customers
© TestDome, 2022.