Catch Use of Assignment Operator Instead of Equality Operator

Catch Use of Assignment Operator Instead of Equality Operator
0.0 0

#1

Tell us what’s happening:

Your code so far


let x = 7;
let y = 9;
let result ;

if(x === y) {
  result = "Equal";
} else {
  result = "Not equal";
}

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator/


#2

You did the challenge correctly, but unfortunately the challenge broke because you modified some of the test code. Make sure you have exclamation points at the end of your strings like the challenge originally did. Here is the working code:

let x = 7;
let y = 9;
let result = "to come";

if(x == y) {
  result = "Equal!";
} else {
  result = "Not equal!";
}

console.log(result);

@raisedadead, is this an issue that needs to be fixed, or just unexpected behavior?


#3

It would be very tough to identify for all cases where the seed code is changed. Hence breaking the tests as in this case.

Sure adding more tests is OK for catching such errors. I would advice rather this should be handled in the usual Read-Search-Ask method.

So, per me I think we should not have to update the tests further.


#4

thanx a lot brother:hugs::hugs::hugs::hugs::hugs::hugs::hugs::hugs::hugs::hugs: