Fourth to bottom line. It’s because your spacing makes it difficult to spot. topCircle.setposition expects two parameters. You didn’t specify the second one. Of course if you copy pasted into an IDE, it would have spotted this immediately for you.
Sort of. It doesn't look like because of the way we read this as humans, but because you're missing a closing parenthesis above, the computer is reading the highlighted line as the second argument in that setPosition function.
The computer doesn't register the white space in your code, so it looks like
Once it hits that semicolon, it sees that it's missing a closing parenthesis. If you were to put a closing parenthesis right before that semi colon though, you'd still get an error because obviously your function would be written incorrectly.
It is more like there is an unresolved mistake on the line above it. Javascript's processor proceeds to go to the next line because it expects the parameter to be there.
Javascript doesn't know what you want so it thinks the second parameter for setposition is your next declaration, setcolor. This is probably not what you want.
So, it says that setcolor is the error. But, really, it is because you didn't add the setposition second parameter or close it.
Of course if you copy pasted into an IDE, it would have spotted this immediately for you.
I had a couple of my students start using an IDE recently and it blew their mind. They were all like "Holy crap, I don't even have to know what I'm doing! The computer just do it all for me!"
Which isn't exactly the case, but it was kind of funny to see.
I would say I spend 30 minutes a week just reading up on hotkeys for VSCode or Sublime Text.
Modern Linters are also great for code consistency.
But, yeah, it doesn't exactly write the code for you. It certainly improves productivity and gets rid of those "what the hell am I missing?" errors. In 2007, I wrote some PHP script directly to a production site and was testing based on whether the white screen of death came up or not. Not my proudest moment.
Might be better to also point out that topCircle.setColor is being taken by the compiler to be the second parameter which is why syntactically, the ")" is missing.
UGH! That’s even worse. But truly just joking around since you’ve already been given the answer 😁if no one had answered you yet, I wouldn’t have been a smart ass. Promise!
4
u/PauseNatural Oct 03 '22
Fourth to bottom line. It’s because your spacing makes it difficult to spot. topCircle.setposition expects two parameters. You didn’t specify the second one. Of course if you copy pasted into an IDE, it would have spotted this immediately for you.
1
u/Evening_Appropriate Oct 03 '22
You’re using a crappy text editor
1
u/Evening_Appropriate Oct 03 '22
UGH! That’s even worse. But truly just joking around since you’ve already been given the answer 😁if no one had answered you yet, I wouldn’t have been a smart ass. Promise!
1
u/raedr7n Oct 03 '22
Missing paren on line 15. Like it says.
1
u/ryujinnie58 Oct 03 '22
Try color.gray instead
1
u/Void4GamesYT Oct 03 '22
The "setposition" tag needed two )s, you only put 1 and 2 (s.
1
u/Hikarunoryoma Oct 04 '22
Using another device to take this photo instead of a screenshot
0
u/[deleted] Oct 03 '22
[deleted] — view deleted comment
1
u/[deleted] Oct 03 '22
[removed] — view removed comment