JSFiddle - React, Tailwind, and code Playground

HTML

<form id="myForm">
  <select id="selectNumber">
    <option>Choose a number</option>
  </select>
</form>

JavaScript

var myArray = new Array("1", "2", "3", "4", "5");


// Get dropdown element from DOM
var dropdown = document.getElementById("selectNumber");

// Loop through the array
for (var i = 0; i < myArray.length; ++i) {
    // Append the element to the end of Array list
    dropdown[dropdown.length] = new Option(myArray[i], myArray[i]);
}