Why does it need ==== and not just =

I had to finally just look up what to do for this challenge because I could not understand why the code would not work.

Even though I know the answer now, I still don’t understand why I would need to specify strict equality in order for this code to work. I had the right format for everything, except strict equality.

Why wouldn’t just putting one = operator suffice?

If anyone can provide an explanation I would really appreciate it because I would like to actually understand what is going on here.

Thanks!

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/golf-code

one equal sign operator is for assigining values to a variable , ala
const x = 2
Means let x have the value of 2.
But two (or three) operators are for checking equivalence of data or variables, example
x==y
Means x is equal to y , if the the variables or data on both sides of the operator are equivalent, the statement above will return true otherwise it will return false

The difference between 2 and 3 operators is to check for strict (===) equality, you can read more about that here:

1 Like

Thank you!

I get it now. I just went through and rewrote the code and tried == to see if I understood it properly and it worked just like === for this particular code, which after reading is what I was understanding.

Thanks again.