JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<head>
<title>calculatorOnclick</title>
<meta charset="utf-8">
<script>
var operandOne=0, operandTwo=0, oper=0, itog;
var fb=Array();
for (var i=0; i<=9; i++){
fb[i]=function (x){
if(oper=="0"){
operandOne+=+x.value;
operandOne+="";
alert(operandOne);}
else if(oper=="plu"){
operandTwo+=+x.value;
operandTwo+="";
alert(operandTwo);}
}
}
function fbPlu(bPlu){
oper="plu";
alert(oper);
}
function fbRav(bRav){
operandOne=+operandOne;
operandTwo=+operandTwo;
if(oper="plu"){
itog=operandOne+operandTwo;
alert(itog);}
else alert('код еще не написан');
}
</script>
</head>
<body>
<table border="2">
<tr>
<td colspan="4"><input type="text" name="text" value="0"></td>
</tr>
<tr>
<td><input type="button" name="b[7]" value="7" onclick="fb[7](this)"></td>
<td><input type="button" name="b[8]" value="8" onclick="fb[8](this)"></td>
<td><input type="button" name="b[9]" value="9" onclick="fb[9](this)"></td>
<td><input type="button" name="bCha" value="/" onclick="fbCha(this)"></td>
</tr>
<tr>
<td><input type="button" name="b[4]" value="4" onclick="fb[4](this)"></td>
<td><input type="button" name="b[5]" value="5" onclick="fb[5](this)"></td>
<td><input type="button" name="b[6]" value="6" onclick="fb[6](this)"></td>
<td><input type="button" name="bPro" value="*" onclick="fbPro(this)"></td>
</tr>
<tr>
<td><input type="button" name="b[1]" value="1" onclick="fb[1](this)"></td>
<td><input type="button" name="b[2]" value="2" onclick="fb[2](this)"></td>
<td><input type="button" name="b[3]" value="3" onclick="fb[3](this)"></td>
<td><input type="button" name="bMin" value="-" onclick="fbMin(this)"></td>
</tr>
<tr>
<td><input type="button" name="b[0]" value="0" onclick="fb[0](this)"></td>
<td><input type="button" name="bToc" value="." onclick="fbToc(this)"></td>
<td><input type="button" name="bRav" value="=" onclick="fbRav(this)"></td>
<td><input type="button" name="bPlu" value="+"...