+ 7
Function Not Calling [Solved]
Hello, I am creating a calculator in HTML, CSS, and JS. But having trouble executing it. When clicked on = it should call evaluate() function in which I am converting my problem string to int and giving the output. Below is the error I am getting in the console while clicking =. Uncaught TypeError: Failed to execute 'evaluate' on 'Document': 2 arguments required, but only 0 present. at HTMLInputElement.onclick There are no arguments for the evaluate method. https://code.sololearn.com/WA7a2215a14a/?ref=app
4 Answers
+ 5
'evaluate' is a method of 'document' object, and is called first rather than your own global function (defined on 'window' object), as you call it from the inlined attribute...
you should explicitly call it from 'window':
onclick="window.evaluate()"
or change your function name (not present in 'document' properties, such as 'compute')
+ 2
Thanks the issue has been resolved
0
Just change the evaluate function name like : evaluate to eq or something , i already fix this issue just change function name evaluate to eq.
- 2
tt1