;(function () {
let screen = document.querySelector('.screen')
let buttons = document.querySelectorAll('.btn')
let clear = document.querySelector('.btn-clear')
let equal = document.querySelector('.btn-equal')
let answer = ''
buttons.forEach(function (button) {
button.addEventListener('click', function (e) {
let value = e.target.dataset.num
if (value) {
screen.value += value
}
})
})
let Result = () => {
try {
screen.value = eval(screen.value)
} catch (err) {
alert('Enter the valid input')
}
}
clear.addEventListener('click', function (e) {
screen.value = ''
})
equal.addEventListener('click', () => {
Result()
})
})()
В разметке убрать онклик на кнопке btn-equal