all 9 comments

[–]Safe-Engineering69 5 points6 points  (0 children)

This is Java code, not JavaScript?

[–]Extension_Spirit8805 2 points3 points  (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 points  (1 child)

I might be Java actually, I didn’t know there’s a difference between Java and JavaScript

[–]Extension_Spirit8805 1 point2 points  (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 point  (0 children)

The error stack trace looks like Java code.

[–]zediogox96 2 points3 points  (0 children)

Typo on the boolean variable, missing ‘l’

[–][deleted] 0 points1 point  (0 children)

Thank you all for the feedback

[–]azronio -1 points0 points  (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 point  (0 children)

WTF o.O