Guide: Use the Conditional (Ternary) Operator BUG

Hello,
I discovered a bug in the solution guide of excercise: Basic JavaScript: Use the Conditional (Ternary) Operator. The solution guide can be found here: (unfortunately i can’t post links yet. You can find the guide by clicking: “Get a hint” inside excersice: Basic JavaScript: Use the Conditional (Ternary) Operator.

Solution (wrong):

function checkEqual(a, b) {
  return (a = b ? true : false );
}

checkEqual(1, 2);

Solution (correct):

function checkEqual(a, b) {
  return (a === b ? true : false );
}

checkEqual(1, 2);

Why:
b should not be assigned to a. b should be checked if its equal to a.

Thanks for helping make FCC better. You can submit updates to the guide through our GitHub.

1 Like

I tried to find the dedicated github file but the only file i could find was this one: https://github.com/freeCodeCamp/freeCodeCamp/blob/master/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.english.md which is the right solution. I don’t think i’m searching at the right place.

If the guide file on the GitHub already shows the corrected solution, then probably someone has already spotted the error and corrected it. There is a QA process that changes go through before they are released to the live site.

1 Like