0

'How to fix' Uncaught TypeError: Cannot read property 'addEventListener' of null at script

equalsButton.addEventListener('click',button =>{KeyboardEvent
calculator.compute()
calculator.updateDisplay()

1 Answers1

0

This will work for me:

equalsButton.addEventListener('click', button => {
  //calculator.compute()
  //calculator.updateDisplay()
  alert('works fine');
});

https://jsbin.com/busehe/2/edit

I can't reach KeyboardEvent and calculator objects, since your code looks like cut out of context. You may provide the whole code with surrounded context.

Viktor
  • 168
  • 7