How do I select a dropdown in Selenium using JavaScriptExecutor?

How do I select a dropdown in Selenium using JavaScriptExecutor?

To choose an option from the dropdown, we may leverage the JavascriptExecutor function. The dropdown option may be set using the element’s “value” attribute.