+ 1
Unexpected syntax error line 59 javascript
Please help what is wrong with my return function in line 59 https://code.sololearn.com/W6Cyj23TBI0I/?ref=app
8 ответов
+ 2
Don't put that everywhere. Just put it at places where you have got only one button but still you are using querySelectorAll , i.e. equals, clear, delete and functions like that not in numbers and operands. Just remove that [0] from lines: 100, 103, 115 and 118.
+ 1
You haven't got the parentheses matched in line 58. Just add another ')' before the return statement.
PS You have got bugs with your query selector functions. For buttons that are only 1 in number (such as eq to and clear buttons), you shouldn't use document.querySelectorAll function, as it returns an array instead of a single element. If you still want to stick with it, use this
document.querySelectorAll(...)[0]
Just replace that ... with whatever selector you are using.
+ 1
The next errors occur because the querySelectorAll function returns an array of elements instead of a single element even if there's a single object in the array. And you can't attach event listeners to arrays. That's why next errors are occurring. Just put a [0] after the querySelectorAll function to avoid these errors. What this [0] does is that it accesses the first eleme.t in the array and then you can attach your eventListeners with it without any errors
+ 1
Now I have uncaught reference error line 50, damn tried so long and don't get what's the problem. The + - / * don't appear on the screen and del button don't work right delete function
https://code.sololearn.com/Wm7aQyKvKV1m/?ref=app
+ 1
In line 50 make it this.currentOperand instead of current operand and in line 73 make it case "X" instead of case "*". It all works perfectly then
0
Thanx,but didn't understand what's the next error and what closes the third ")" ?
0
Now I get a error on page 125. I put the [0] everywhere and still don't work
https://code.sololearn.com/Wm7aQyKvKV1m/?ref=app
0
I try to make again with less looking and stuck here trying to get .output on top of the numbers but can't.. and why span-two don't work?
https://code.sololearn.com/WjhjUxE7nXyo/?ref=app