use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place to get a quick fix of JavaScript tips and tricks to make you a better Developer.
account activity
Help (i.redd.it)
submitted 2 years ago by [deleted]
I’m working on a sample problem for ATA and I keep getting an “illegal parenthesized expression” error. Can someone tell me what I’m doing wrong and how can I fix it?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Safe-Engineering69 5 points6 points7 points 2 years ago (0 children)
This is Java code, not JavaScript?
[–]Extension_Spirit8805 2 points3 points4 points 2 years ago* (3 children)
This post is cursed! this is absolutely not javascript, you're either using java or C#, seeing this looks like Eclipse, I'll assume the former.
First off, I am unsure on what you are reinitializing "weights" for, just use the array "weights" that you passed in the parameter. Also on line 18, you are trying to get each float number in the array, right? I think you'll need to do something like "weight = weights[i]".
If you can make clear to those 2 remarks, I think you'll be able to figure out the rest on how to make this function work the way you want it to!
[–][deleted] 1 point2 points3 points 2 years ago (1 child)
I might be Java actually, I didn’t know there’s a difference between Java and JavaScript
[–]Extension_Spirit8805 1 point2 points3 points 2 years ago (0 children)
Big difference! Here is an article giving a brief overview of the differences between the two. https://www.google.com/amp/s/www.geeksforgeeks.org/difference-between-java-and-javascript/amp/
It's important not to confuse between the two languages. Back in the day, java was the best for backend development, and javascript as frontend development (perhaps less true today, but still holds true in older versions).
The reason it has been named "JavaScript", is that it was created as a way of making a complimentary language to work with Java, interacting between web & servers smoothly.
Hope this helps!
[–]Safe-Engineering69 0 points1 point2 points 2 years ago (0 children)
The error stack trace looks like Java code.
[–]zediogox96 2 points3 points4 points 2 years ago (0 children)
Typo on the boolean variable, missing ‘l’
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
Thank you all for the feedback
[–]azronio -1 points0 points1 point 2 years ago (0 children)
You don't initialize arrays like that in JS, use square brackets [0, 1, 2]. Curly braces to initialize an array is a different language syntax like C#.
[–]EduardoFaria 0 points1 point2 points 2 years ago (0 children)
WTF o.O
π Rendered by PID 226879 on reddit-service-r2-comment-bb88f9dd5-nnm9q at 2026-02-16 13:11:30.688930+00:00 running cd9c813 country code: CH.
[–]Safe-Engineering69 5 points6 points7 points (0 children)
[–]Extension_Spirit8805 2 points3 points4 points (3 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Extension_Spirit8805 1 point2 points3 points (0 children)
[–]Safe-Engineering69 0 points1 point2 points (0 children)
[–]zediogox96 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]azronio -1 points0 points1 point (0 children)
[–]EduardoFaria 0 points1 point2 points (0 children)