JSFiddle - React, Tailwind, and code Playground

HTML

<div id='js-out'></div>
<div id='js-example'></div>

JavaScript

function makeButton(functionIn, text){
  var button = document.createElement('BUTTON');
  var btTxt = document.createTextNode(text);
  button.onclick = functionIn;
  button.appendChild(btTxt);
  document.getElementById('js-out').appendChild(button);
}

var buttonFunctionOne = function() {
    console.log(this);
}
var buttonFunctionTwo = function() {
    console.log(this);
}

makeButton(buttonFunctionOne,'button one');
makeButton(buttonFunctionOne,'button two');
makeButton(buttonFunctionTwo,'button three');