I am writing modular javascript code. I wrote a basic calculator with two inputs and four buttons which performs arithmetic operations. When I run my it shows this error in console.
Uncaught ReferenceError: add is not defined
This happens for all buttons. How can I fix this and why it does not work?
Here is my code
You are mixing up variables and object properties. Javascript never implicitly looks up object properties – it’s always a variable lookup with the exception of global object and
with-statement.So specify the object: