Finding the Use Conditional Logic with If Statements highly illogical

Finding the Use Conditional Logic with If Statements highly illogical
0

#1

Tell us what’s happening:
I received a message: “SyntaxError: illegal character” and also only got the first part of the challenge correct: " trueOrFalse should be a function"

// Example
function ourTrueOrFalse(isItTrue) {
if (isItTrue) {
return “Yes, it’s true”;
}
return “No, it’s false”;
}

// Setup
function trueOrFalse(wasThatTrue) {

// Only change code below this line.
if(wasThatTrue) {
return “Yes, that was true”;
}
return “No, that was false”;
}
// Only change code above this line.

// Change this value to test
trueOrFalse(true);

Your code so far

// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) { 
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {

  // Only change code below this line.
  if(wasThatTrue) {
return “Yes, that was true”;
}
return “No, that was false”;
}
// Only change code above this line.



// Change this value to test
trueOrFalse(true);```
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:55.0) Gecko/20100101 Firefox/55.0```.

**Link to the challenge:**
https://www.freecodecamp.org/challenges/use-conditional-logic-with-if-statements

#2

Your logic is correct, but you are using characters versus " characters which makes a difference (that’s the SyntaxError). There should be a syntax highlighter showing errors like a red X and to the left of the line numbers and the characters inside the quotes should change color to signify it is a string.


#3

Now I am more confused. I don’t really know what “character versus” means. I tried to retype, and still getting the same errors. I think there may be something missing here, or it’s buggy and I can’t figure out what. Although it didn’t work, I even tried what another poster shared on Github, to make it like so:

if (wasThatTrue) { 
  return “Yes, that was true”;
  }
  {
  return “No, that was false”;
  }
  
test(true); // returns "It was true"
test(false); // returns "It was false"

#4

It could be buggy, I’m not sure.

characters versus " means those two things I’ve just typed are two different characters. I guess you call them both quotation characters, but one is slightly angled and the other one is vertical. When you type in the double quotes character in the FCC editor with your Shift + ' (single quote button) it should produce the vertical double quotes which is the one you want. If you’re copying and pasting it might not be the same. You can see that you have the right one when the syntax is highlighted (it changed color from white to a different color, say pink).


#5

It finally worked! Thanks for enlightening me. I hope that I remember the whole shift trick on the ’ button! Is it me, or is that stuff left to intuition and guessing whereas FCC could spell out the correction you kindly provided. Thanks again!


#6

Side note, but may be helpful for you: for strings in JavaScript particularly, you can either use the ' (single quote, no need to use the Shift key) or " (double quotes, with the Shift key + single quote key).