JSFiddle - React, Tailwind, and code Playground

HTML

<div id='outputArea'>
</div>

JavaScript

var outputAreaRef = document.getElementById("outputArea");
var output = "";

function flexible(fOperation, operand1, operand2)
{
var result  = fOperation(operand1, operand2);

return result;
}

function sum(a, b) {
return a+b;
}

output += flexible(sum, 3, 5) + "<br/>";
output += flexible(function(num1, num2) {return num1 * num2}, 3, 5) + "<br/>"; 

outputAreaRef.innerHTML = output;