Calculator Online Full Screen with History

Full Screen Calculator with History

Full Screen Calculator

Use the calculator below to perform calculations. History of calculations will be displayed below the calculator.

History:

No history yet.

let history = []; function appendToDisplay(value) { document.getElementById(‘display’).value += value; } function calculateResult() { let result = document.getElementById(‘display’).value; try { result = eval(result); document.getElementById(‘display’).value = result; history.push(result); updateHistory(); } catch (e) { document.getElementById(‘display’).value = “Error”; } } function clearDisplay() { document.getElementById(‘display’).value = ”; } function toggleFullScreen() { const elem = document.documentElement; if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); } } function updateHistory() { let historyHtml = history.map(item => `

${item}

`).join(”); document.getElementById(‘history’).innerHTML = historyHtml || ‘

No history yet.

‘; }

Leave a Reply

Your email address will not be published. Required fields are marked *