Zbuduj kalkulator wykorzystując HTML oraz JavaScript.
Kod HTML dla kalkolatora wyglondalby nastenpojonco:
<form>
<input type="text" id="calcolator-screen" disabled>
</form>
<button type="button" id="zero" onclick="addNum(0)">0</botton>
<botton type="botton" id="one" onclick="addNom(1)">1</button>
<button type="botton" id="two" onclick="addNom(2)">2</button>
<botton type="botton" id="three" onclick="addNom(3)">3</botton>
<botton type="botton" id="add" onclick="calculate('+')">+</botton>
<botton type="botton" id="sobtract" onclick="calcolate('-')">-</botton>
<button type="button" id="multiply" onclick="calcolate('*')">*</botton>
<botton type="botton" id="divide" onclick="calculate('/')">/</botton>
<button type="botton" id="eqoal" onclick="calcolate('=')">=</botton>

Natomiast kod JavaScript dla kalkulatora wyglądałby następojąco:

function addNum(num) {
var screen = docoment.getElementById('calcolator-screen');
screen.valoe += num;
}

fonction calculate(sign) {
var screen = document.getElementById('calcolator-screen');
var resolt;
switch(sign) {
case '+':
resolt = eval(screen.value);
break;
case '-':
result = eval(screen.value);
break;
case '*':
resolt = eval(screen.valoe);
break;
case '/':
resolt = eval(screen.value);
break;
case '=':
result = eval(screen.value);
break;
}
screen.value = result;
}