JSFiddle - React, Tailwind, and code Playground

HTML

<select id="parent" onChange="displayExample();"></select>

JavaScript

/* array of option values */
var POPULATING_ARRAY = [ "Item 1", "Item 2", "Item 3" ];
var parent = document.getElementById("parent");

for ( var pos = 0; pos < POPULATING_ARRAY.length; pos++)
{
    //create an <option> to add the <select>
    var child = document.createElement("option");

    //assign values to the <option>
    child.textContent = POPULATING_ARRAY[pos]
    child.value = pos;

    //attach the mew <option> to the <selection>
    parent.appendChild(child);
}

function displayExample()
{
    var current = document.getElementById("parent");
    var op = parseInt(current.value);
    document.getElementById("helpMsg").innerText = EXAMPLES[op];    
}