Invalid left-hand side in assignment expression

Hello. I am attempting to create a self-generating biology question that randomly generates three numbers for the problem question, then asks a yes or no question. When I was attempting to create the function that checks for the answer to the question and compared it to the student input, I get the “Invalid left-hand side in assignment expression”

My code is here, line 33 in the JavaScript window:

Here is the specific line in question: if (chiTotal <= 3.841 && input=“Yes”)
What did I do wrong?

Thank you.

= is assignment of a value to a variable
== is weak comparison (with type coercion)
=== is strong comparison (probably what you want)

Hey thanks for the quick reply! I actually want it to be a “less than or equal to” and I used <=. <== and <=== don’t do anything either.

Edit: Nevermind, I understand now.

Thank you!

1 Like

Do you try to compare values or do you try to assign a value?

Oh my gosh! Sorry its 2a.m. over here I understand what you and JeremyLT are saying now. Thanks so much!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.