+ 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

8th Mar 2021, 6:52 AM
Sharique Khan
Sharique Khan - avatar
4 odpowiedzi
+ 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')
8th Mar 2021, 7:39 AM
visph
visph - avatar
+ 2
Thanks the issue has been resolved
8th Mar 2021, 7:42 AM
Sharique Khan
Sharique Khan - avatar
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.
18th Oct 2021, 3:42 AM
Roktim Sazib
Roktim Sazib - avatar
- 2
tt1
13th Mar 2021, 11:33 AM
Sasa Ivanov
Sasa Ivanov - avatar