How to get a web element by their XPath in JavaScript Selenium WebDriver

As we have the getElementByXpath() method in Selenium Java. In a similar way, can we get a web element by their XPath in Selenium JavaScript, to get the innerHTML?

PS: I tried using ID selector, but the desired web element did not had any ID.