JSFiddle - React, Tailwind, and code Playground

by bgrins

HTML

<ul id='ul'></ul>

JavaScript

var s = ["hi", "there", "buddy"];

document.body.appendChild(
    
    s.map(function(w) {
        var li = document.createElement('li');
        li.textContent = w;
        li.addEventListener('click', function() {
           alert(w); 
        }, false);
        
        return li;
    }),
    
    document.createElement("ul")
)