UiPath Interview Question

Some document traversal using javascript, technical discussion around implementation