Implement a function getElementByTagName(root, tagName) that returns an array of all descendant elements of the given root element matching the specified tag name.
The function should:
Example
const doc = new DOMParser().parseFromString( `<div> <span>One</span> <p>Two</p> <div><span>Three</span></div> </div>`, 'text/html' ); getElementByTagName(doc.body, 'span'); // Returns [<span>One</span>, <span>Three</span>]
JavaScript Function
No test results yet
Click "Run" to execute tests