JSFiddle - React, Tailwind, and code Playground

HTML

<input id="formula"><input type="button" value="=" onClick="go()">
<span id="otvet"></span>

JavaScript

function go()
{
	var formula = document.getElementById('formula').value;
  var func = new Function('formula', 'document.getElementById(\'otvet\').innerHTML = eval(formula)');
  func(formula);
}